pub trait WindowState: EstimateSize {
// Required methods
fn append(&mut self, key: StateKey, args: SmallVec<[Datum; 2]>);
fn curr_window(&self) -> StatePos<'_>;
fn slide(&mut self) -> Result<(Datum, StateEvictHint)>;
fn slide_no_output(&mut self) -> Result<StateEvictHint>;
// Provided methods
fn enable_persistence(&mut self) { ... }
fn snapshot(&self) -> Option<WindowStateSnapshot> { ... }
fn restore(&mut self, _snapshot: WindowStateSnapshot) -> Result<()> { ... }
}Required Methods§
Sourcefn append(&mut self, key: StateKey, args: SmallVec<[Datum; 2]>)
fn append(&mut self, key: StateKey, args: SmallVec<[Datum; 2]>)
Append a new input row to the state. The key is expected to be increasing.
Sourcefn curr_window(&self) -> StatePos<'_>
fn curr_window(&self) -> StatePos<'_>
Get the current window frame position.
Sourcefn slide(&mut self) -> Result<(Datum, StateEvictHint)>
fn slide(&mut self) -> Result<(Datum, StateEvictHint)>
Slide the window frame forward and collect the output and evict hint. Similar to Iterator::next.
Sourcefn slide_no_output(&mut self) -> Result<StateEvictHint>
fn slide_no_output(&mut self) -> Result<StateEvictHint>
Slide the window frame forward and collect the evict hint. Don’t calculate the output if possible.
Provided Methods§
Sourcefn enable_persistence(&mut self)
fn enable_persistence(&mut self)
Enable persistence for this window state. When enabled, the state may return
CanEvict hints and should support snapshot/restore.
Sourcefn snapshot(&self) -> Option<WindowStateSnapshot>
fn snapshot(&self) -> Option<WindowStateSnapshot>
Create a snapshot of the current state for persistence.
Returns None if the state doesn’t support persistence.
Sourcefn restore(&mut self, _snapshot: WindowStateSnapshot) -> Result<()>
fn restore(&mut self, _snapshot: WindowStateSnapshot) -> Result<()>
Restore the state from a snapshot. Called during recovery before replaying rows.