pub struct InMemoryLedger { /* private fields */ }Expand description
Thread-safe in-memory reference implementation of an append-only audit ledger.
Implementations§
Trait Implementations§
Source§impl AuditLedgerReader for InMemoryLedger
impl AuditLedgerReader for InMemoryLedger
Source§fn get_event(&self, sequence: u64) -> Result<Option<AuditEvent>, LedgerError>
fn get_event(&self, sequence: u64) -> Result<Option<AuditEvent>, LedgerError>
Fetch an individual event by its 1-indexed sequence number.
Source§fn head(&self) -> Result<Option<AuditEvent>, LedgerError>
fn head(&self) -> Result<Option<AuditEvent>, LedgerError>
Retrieve the most recently committed event from the head of the chain.
Source§fn all_events(&self) -> Result<Vec<AuditEvent>, LedgerError>
fn all_events(&self) -> Result<Vec<AuditEvent>, LedgerError>
Return an in-order snapshot of all events committed to the ledger.
Source§impl AuditLedgerWriter for InMemoryLedger
impl AuditLedgerWriter for InMemoryLedger
Source§fn append(
&mut self,
event_type: &str,
actor: &str,
payload: &str,
) -> Result<AuditEvent, LedgerError>
fn append( &mut self, event_type: &str, actor: &str, payload: &str, ) -> Result<AuditEvent, LedgerError>
Cryptographically append a new action record to the ledger.
Source§impl AuditVerifier for InMemoryLedger
impl AuditVerifier for InMemoryLedger
Source§fn verify_chain(&self) -> Result<ChainVerificationReport, LedgerError>
fn verify_chain(&self) -> Result<ChainVerificationReport, LedgerError>
Traverse the ledger from genesis to head, verifying all hashes and sequence numbers.
Source§impl Clone for InMemoryLedger
impl Clone for InMemoryLedger
Auto Trait Implementations§
impl Freeze for InMemoryLedger
impl RefUnwindSafe for InMemoryLedger
impl Send for InMemoryLedger
impl Sync for InMemoryLedger
impl Unpin for InMemoryLedger
impl UnsafeUnpin for InMemoryLedger
impl UnwindSafe for InMemoryLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more