Skip to main content

PadLedgerStore

Trait PadLedgerStore 

Source
pub trait PadLedgerStore: Send + Sync {
    // Required methods
    fn load_cursor(&self) -> u64;
    fn commit_cursor(&self, cursor: u64);
}
Expand description

The durable record of how far the send cursor has advanced — the single piece of state whose loss would be catastrophic, because reissuing a consumed offset is a two-time pad. An implementation must make PadLedgerStore::commit_cursor durable (fsync) before the caller emits the sealed frame, so a crash can only ever waste pad, never reuse it.

Required Methods§

Source

fn load_cursor(&self) -> u64

The highest cursor durably committed so far (0 if the pad is fresh).

Source

fn commit_cursor(&self, cursor: u64)

Durably record that the send cursor has advanced to cursor.

Implementors§

Source§

impl PadLedgerStore for FileLedger

Available on non-WebAssembly only.
Source§

impl PadLedgerStore for MemLedger