Skip to main content

OpLog

Trait OpLog 

Source
pub trait OpLog: Send + Sync {
    // Required methods
    fn append(&self, op: &ArrayOp) -> ArrayResult<()>;
    fn scan_from<'a>(&'a self, from: Hlc) -> ArrayResult<OpIter<'a>>;
    fn scan_range<'a>(
        &'a self,
        array: &str,
        from: Hlc,
        to: Hlc,
    ) -> ArrayResult<OpIter<'a>>;
    fn len(&self) -> ArrayResult<u64>;
    fn drop_below(&self, hlc: Hlc) -> ArrayResult<u64>;
}
Expand description

Storage-agnostic interface for an append-only array operation log.

Implementations are expected to be Send + Sync and durable. An in-memory implementation suitable for tests is provided by InMemoryOpLog below.

Required Methods§

Source

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

Append an operation to the log.

Must be idempotent: re-appending an op with the same (array, hlc) is a no-op.

Source

fn scan_from<'a>(&'a self, from: Hlc) -> ArrayResult<OpIter<'a>>

Iterate all ops with hlc >= from, in HLC order, across all arrays.

Source

fn scan_range<'a>( &'a self, array: &str, from: Hlc, to: Hlc, ) -> ArrayResult<OpIter<'a>>

Iterate ops for array with from <= hlc <= to, in HLC order.

Source

fn len(&self) -> ArrayResult<u64>

Return the total number of ops in the log (across all arrays).

Source

fn drop_below(&self, hlc: Hlc) -> ArrayResult<u64>

Drop all ops whose hlc < hlc and return the count dropped.

Used by GC after snapshotting ops below the min-ack frontier.

Implementors§