pub struct SessionWindow { /* private fields */ }Expand description
A session window that groups events separated by gaps of inactivity.
Events are accumulated into a session. When a new event arrives after a gap exceeding the configured duration, the current session is closed (emitted) and a new session begins with the incoming event.
Supports both row-oriented and columnar access patterns:
flush_shared(): Row-oriented access for backward compatibilityflush_columnar(): Columnar access for SIMD-optimized aggregations
Implementations§
Source§impl SessionWindow
impl SessionWindow
pub fn new(gap: Duration) -> Self
Add a shared event to the session window. Returns the completed session if the gap was exceeded.
Sourcepub fn check_expired(&mut self, now: DateTime<Utc>) -> Option<Vec<SharedEvent>>
pub fn check_expired(&mut self, now: DateTime<Utc>) -> Option<Vec<SharedEvent>>
Check if this session has expired (last event time + gap < now). Returns accumulated events if expired, None otherwise.
Flush all events as SharedEvent references.
Sourcepub fn flush_columnar(&mut self) -> ColumnarBuffer
pub fn flush_columnar(&mut self) -> ColumnarBuffer
Flush and return the columnar buffer for SIMD-optimized aggregations.
Sourcepub fn checkpoint(&self) -> WindowCheckpoint
pub fn checkpoint(&self) -> WindowCheckpoint
Create a checkpoint of the current session state.
Sourcepub fn restore(&mut self, cp: &WindowCheckpoint)
pub fn restore(&mut self, cp: &WindowCheckpoint)
Restore session state from a checkpoint.
Sourcepub fn advance_watermark(
&mut self,
wm: DateTime<Utc>,
) -> Option<Vec<SharedEvent>>
pub fn advance_watermark( &mut self, wm: DateTime<Utc>, ) -> Option<Vec<SharedEvent>>
Advance watermark — close session if watermark exceeds last_event_time + gap.
Trait Implementations§
Source§impl ColumnarAccess for SessionWindow
impl ColumnarAccess for SessionWindow
Source§fn columnar(&self) -> &ColumnarBuffer
fn columnar(&self) -> &ColumnarBuffer
Source§fn columnar_mut(&mut self) -> &mut ColumnarBuffer
fn columnar_mut(&mut self) -> &mut ColumnarBuffer
Source§fn get_float_column(&mut self, field: &str) -> &[f64]
fn get_float_column(&mut self, field: &str) -> &[f64]
Source§fn get_int_column(&mut self, field: &str) -> &[i64]
fn get_int_column(&mut self, field: &str) -> &[i64]
Auto Trait Implementations§
impl Freeze for SessionWindow
impl RefUnwindSafe for SessionWindow
impl Send for SessionWindow
impl Sync for SessionWindow
impl Unpin for SessionWindow
impl UnsafeUnpin for SessionWindow
impl UnwindSafe for SessionWindow
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
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>
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>
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