pub struct WindowState<W: Window, T> {
pub window: W,
pub elements: Vec<(DateTime<Utc>, T)>,
pub count: usize,
pub triggered: bool,
pub last_watermark: Option<Watermark>,
}Expand description
Tracks the state of a window including its watermark context.
Fields§
§window: WThe window this state belongs to.
elements: Vec<(DateTime<Utc>, T)>Elements currently in the window.
count: usizeCount of elements.
triggered: boolWhether the window has been triggered.
last_watermark: Option<Watermark>Last watermark that affected this window.
Implementations§
Source§impl<W: Window, T: Clone> WindowState<W, T>
impl<W: Window, T: Clone> WindowState<W, T>
Sourcepub fn update_watermark(&mut self, watermark: Watermark)
pub fn update_watermark(&mut self, watermark: Watermark)
Updates the watermark for this window.
Sourcepub fn can_be_gc(
&self,
current_watermark: &Watermark,
allowed_lateness: ChronoDuration,
) -> bool
pub fn can_be_gc( &self, current_watermark: &Watermark, allowed_lateness: ChronoDuration, ) -> bool
Returns true if the window should be garbage collected.
A window can be GC’d if it has been triggered and the watermark has passed the window’s end time plus allowed lateness.
Sourcepub fn mark_triggered(&mut self)
pub fn mark_triggered(&mut self)
Marks the window as triggered.
Trait Implementations§
Auto Trait Implementations§
impl<W, T> Freeze for WindowState<W, T>where
W: Freeze,
impl<W, T> RefUnwindSafe for WindowState<W, T>where
W: RefUnwindSafe,
T: RefUnwindSafe,
impl<W, T> Send for WindowState<W, T>where
T: Send,
impl<W, T> Sync for WindowState<W, T>where
T: Sync,
impl<W, T> Unpin for WindowState<W, T>
impl<W, T> UnwindSafe for WindowState<W, T>where
W: UnwindSafe,
T: UnwindSafe,
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