WindowState

Trait WindowState 

Source
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§

Source

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.

Source

fn curr_window(&self) -> StatePos<'_>

Get the current window frame position.

Source

fn slide(&mut self) -> Result<(Datum, StateEvictHint)>

Slide the window frame forward and collect the output and evict hint. Similar to Iterator::next.

Source

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§

Source

fn enable_persistence(&mut self)

Enable persistence for this window state. When enabled, the state may return CanEvict hints and should support snapshot/restore.

Source

fn snapshot(&self) -> Option<WindowStateSnapshot>

Create a snapshot of the current state for persistence. Returns None if the state doesn’t support persistence.

Source

fn restore(&mut self, _snapshot: WindowStateSnapshot) -> Result<()>

Restore the state from a snapshot. Called during recovery before replaying rows.

Implementors§