Skip to main content

PadLedgerStore

Trait PadLedgerStore 

Source
pub trait PadLedgerStore: Send + Sync {
    // Required method
    fn update(
        &self,
        change: &mut dyn FnMut(&mut PadLedger) -> bool,
    ) -> Result<PadLedger, LedgerError>;
}
Expand description

The durable record of a pad’s position — the state whose loss would be catastrophic, because reissuing a byte the send half has handed out is a two-time pad.

Required Methods§

Source

fn update( &self, change: &mut dyn FnMut(&mut PadLedger) -> bool, ) -> Result<PadLedger, LedgerError>

Read the ledger, let change change it, and record the change durably before returning, all under one exclusive hold: no other holder of this ledger reads it between the read and the record. change answers false to leave the ledger as it was. Returns the ledger as it now stands.

Implementors§

Source§

impl PadLedgerStore for FileLedger

Available on non-WebAssembly only.
Source§

impl PadLedgerStore for MemLedger