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
apply_delta(batch)produces output deltas reflecting how the materialized view changed.full_recompute()returns the complete materialized view.- Correctness invariant: After applying any sequence of deltas,
the materialized view must equal what
full_recompute()would return given the same inputs. materialized_size()returns the number of entries for fallback policy decisions.
Required Methods§
Sourcefn apply_delta(&mut self, batch: &DeltaBatch<K, V>) -> DeltaBatch<K, V>
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.
Sourcefn full_recompute(&self) -> Vec<(K, V)>
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.
Sourcefn materialized_size(&self) -> usize
fn materialized_size(&self) -> usize
Number of entries in the materialized view.
Sourcefn domain(&self) -> ViewDomain
fn domain(&self) -> ViewDomain
Domain of this view (for logging and evidence).