aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/watermark_tracker.h
blob: aa06f614f4e1b50f543d5008b9eb00597f493199 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <optional>
#include <util/system/types.h>

namespace NKikimr {
namespace NMiniKQL {

class TWatermarkTracker {
public:
    TWatermarkTracker(ui64 lag, ui64 granularity);
    std::optional<ui64> HandleNextEventTime(ui64 ts);

private:
    ui64 CalcNextEventWithWatermark(ui64 ts);
    std::optional<ui64> CalcLastWatermark();

private:
    ui64 NextEventWithWatermark = 0;
    const ui64 Delay;
    const ui64 Granularity;
};

} // NMiniKQL
} // NKikimr