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§
Sourcefn append(&self, op: &ArrayOp) -> ArrayResult<()>
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.
Sourcefn scan_from<'a>(&'a self, from: Hlc) -> ArrayResult<OpIter<'a>>
fn scan_from<'a>(&'a self, from: Hlc) -> ArrayResult<OpIter<'a>>
Iterate all ops with hlc >= from, in HLC order, across all arrays.
Sourcefn scan_range<'a>(
&'a self,
array: &str,
from: Hlc,
to: Hlc,
) -> ArrayResult<OpIter<'a>>
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.
Sourcefn len(&self) -> ArrayResult<u64>
fn len(&self) -> ArrayResult<u64>
Return the total number of ops in the log (across all arrays).
Sourcefn drop_below(&self, hlc: Hlc) -> ArrayResult<u64>
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.