Skip to main content

Deriver

Trait Deriver 

Source
pub trait Deriver: Send + Sync {
    // Required methods
    fn derive(
        &self,
        ci: u64,
        base_ops: &[Op],
        before: &dyn DeriveRead,
    ) -> Result<Vec<Op>, StorageError>;
    fn is_derived_key(&self, key: &[u8]) -> bool;
    fn prefix_reaches_derived(&self, prefix: &[u8]) -> bool;
}
Expand description

Deterministic derivation of derived rows from a commit’s base ops.

Implementations must be pure functions of (ci, base_ops, before): no clock, randomness, or global state, because replay and replicas call the same function and must reach byte-identical state.

Required Methods§

Source

fn derive( &self, ci: u64, base_ops: &[Op], before: &dyn DeriveRead, ) -> Result<Vec<Op>, StorageError>

Materialized derived ops (final values, not deltas) for one commit.

§Errors

Returns StorageError when the base ops or the prior state are inconsistent; the commit (or replay) then fails.

Source

fn is_derived_key(&self, key: &[u8]) -> bool

Whether key belongs to a derived family (so an overlay must derive its staged writes before answering a read of it).

Source

fn prefix_reaches_derived(&self, prefix: &[u8]) -> bool

Whether a scan of prefix can reach derived keys.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§