watermark_tracker.h 476 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <optional>
  3. #include <util/system/types.h>
  4. namespace NKikimr {
  5. namespace NMiniKQL {
  6. class TWatermarkTracker {
  7. public:
  8. TWatermarkTracker(ui64 lag, ui64 granularity);
  9. std::optional<ui64> HandleNextEventTime(ui64 ts);
  10. private:
  11. ui64 CalcNextEventWithWatermark(ui64 ts);
  12. std::optional<ui64> CalcLastWatermark();
  13. private:
  14. ui64 NextEventWithWatermark = 0;
  15. const ui64 Delay;
  16. const ui64 Granularity;
  17. };
  18. } // NMiniKQL
  19. } // NKikimr