Skip to main content

ApplyEngine

Trait ApplyEngine 

Source
pub trait ApplyEngine {
    // Required methods
    fn schema_hlc(&self, array: &str) -> ArrayResult<Option<Hlc>>;
    fn already_seen(&self, array: &str, hlc: Hlc) -> ArrayResult<bool>;
    fn apply_put(&mut self, op: &ArrayOp) -> ArrayResult<()>;
    fn apply_delete(&mut self, op: &ArrayOp) -> ArrayResult<()>;
    fn apply_erase(&mut self, op: &ArrayOp) -> ArrayResult<()>;
    fn invalidate_tile(
        &mut self,
        array: &str,
        coord: &[CoordValue],
    ) -> ArrayResult<()>;
}
Expand description

Abstract interface to local engine state consumed by apply_op.

Implementations live in nodedb-lite and nodedb crates. The trait is intentionally not Send + Sync-bounded — implementations choose their own threading model.

Required Methods§

Source

fn schema_hlc(&self, array: &str) -> ArrayResult<Option<Hlc>>

Return the current schema HLC for array, or None if the array is not known to this replica.

Source

fn already_seen(&self, array: &str, hlc: Hlc) -> ArrayResult<bool>

Return true if hlc has already been applied to array.

Used for idempotent re-delivery detection.

Source

fn apply_put(&mut self, op: &ArrayOp) -> ArrayResult<()>

Apply a Put op to the engine.

Source

fn apply_delete(&mut self, op: &ArrayOp) -> ArrayResult<()>

Apply a Delete op to the engine.

Source

fn apply_erase(&mut self, op: &ArrayOp) -> ArrayResult<()>

Apply an Erase op to the engine.

Source

fn invalidate_tile( &mut self, array: &str, coord: &[CoordValue], ) -> ArrayResult<()>

Invalidate any tile-cache entry covering coord in array.

Called after every successful op application so that subsequent reads see the updated state.

Implementors§