pub struct PerSourceWatermarkTracker { /* private fields */ }Expand description
Tracks watermarks for multiple event sources.
The effective watermark is the minimum watermark across all registered sources, ensuring no source’s events are prematurely considered late.
Implementations§
Source§impl PerSourceWatermarkTracker
impl PerSourceWatermarkTracker
Sourcepub fn register_source(&mut self, name: &str, max_ooo: Duration)
pub fn register_source(&mut self, name: &str, max_ooo: Duration)
Register a source with its maximum out-of-orderness tolerance.
Sourcepub fn observe_event(&mut self, source: &str, event_ts: DateTime<Utc>)
pub fn observe_event(&mut self, source: &str, event_ts: DateTime<Utc>)
Observe an event from a source, updating its watermark.
Sourcepub const fn effective_watermark(&self) -> Option<DateTime<Utc>>
pub const fn effective_watermark(&self) -> Option<DateTime<Utc>>
Get the effective (minimum) watermark across all sources.
Sourcepub fn advance_source_watermark(&mut self, source: &str, wm: DateTime<Utc>)
pub fn advance_source_watermark(&mut self, source: &str, wm: DateTime<Utc>)
Manually advance a source’s watermark (e.g., from upstream context).
Sourcepub fn checkpoint(&self) -> WatermarkCheckpoint
pub fn checkpoint(&self) -> WatermarkCheckpoint
Create a checkpoint of the tracker state.
Sourcepub fn restore(&mut self, cp: &WatermarkCheckpoint)
pub fn restore(&mut self, cp: &WatermarkCheckpoint)
Restore tracker state from a checkpoint.
Sourcepub fn has_sources(&self) -> bool
pub fn has_sources(&self) -> bool
Check if any sources are registered.
Trait Implementations§
Source§impl Debug for PerSourceWatermarkTracker
impl Debug for PerSourceWatermarkTracker
Auto Trait Implementations§
impl Freeze for PerSourceWatermarkTracker
impl RefUnwindSafe for PerSourceWatermarkTracker
impl Send for PerSourceWatermarkTracker
impl Sync for PerSourceWatermarkTracker
impl Unpin for PerSourceWatermarkTracker
impl UnsafeUnpin for PerSourceWatermarkTracker
impl UnwindSafe for PerSourceWatermarkTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more