Skip to main content

IncrementalView

Trait IncrementalView 

Source
pub trait IncrementalView<K: Clone + Eq + Hash, V: Clone + PartialEq> {
    // Required methods
    fn apply_delta(&mut self, batch: &DeltaBatch<K, V>) -> DeltaBatch<K, V>;
    fn full_recompute(&self) -> Vec<(K, V)>;
    fn materialized_size(&self) -> usize;
    fn domain(&self) -> ViewDomain;
    fn label(&self) -> &str;
}
Expand description

The core trait for incremental view maintenance.

An IncrementalView maintains a materialized view that can be updated incrementally via deltas, or fully recomputed as a fallback.

§Type Parameters

  • K: Key type for addressing entries in the materialized view.
  • V: Value type stored at each key.

§Contract

  1. apply_delta(batch) produces output deltas reflecting how the materialized view changed.
  2. full_recompute() returns the complete materialized view.
  3. Correctness invariant: After applying any sequence of deltas, the materialized view must equal what full_recompute() would return given the same inputs.
  4. materialized_size() returns the number of entries for fallback policy decisions.

Required Methods§

Source

fn apply_delta(&mut self, batch: &DeltaBatch<K, V>) -> DeltaBatch<K, V>

Apply a batch of input deltas and produce output deltas.

The output deltas describe how this view’s materialized state changed as a result of the input. These are forwarded to downstream views.

Source

fn full_recompute(&self) -> Vec<(K, V)>

Fully recompute the materialized view from scratch.

Returns all current (key, value) pairs. Used as a fallback when the delta set is too large, or for correctness validation.

Source

fn materialized_size(&self) -> usize

Number of entries in the materialized view.

Source

fn domain(&self) -> ViewDomain

Domain of this view (for logging and evidence).

Source

fn label(&self) -> &str

Human-readable label for this view.

Implementors§