pub struct AppendLedger { /* private fields */ }Expand description
Generic append-only ledger for platform events.
Ledger keys identify logical ledgers (e.g. "audit", "decision",
"relationship", "incident", "reality"). Entries are opaque byte
payloads whose schema is defined by the consumer (Caelum, Digicorp).
Maintains secondary indexes for O(N_key) and O(N_tenant) queries.
Implementations§
Source§impl AppendLedger
impl AppendLedger
Sourcepub fn append(&mut self, entry: LedgerEntry)
pub fn append(&mut self, entry: LedgerEntry)
Appends an entry to the ledger.
Sourcepub fn iter_for_key<'a>(
&'a self,
key: &str,
) -> impl Iterator<Item = &'a LedgerEntry>
pub fn iter_for_key<'a>( &'a self, key: &str, ) -> impl Iterator<Item = &'a LedgerEntry>
Returns an iterator over all entries for the given ledger key.
Sourcepub fn iter_for_tenant(
&self,
tenant_id: TenantId,
) -> impl Iterator<Item = &LedgerEntry>
pub fn iter_for_tenant( &self, tenant_id: TenantId, ) -> impl Iterator<Item = &LedgerEntry>
Returns an iterator over all entries for the given tenant.
Sourcepub fn entry_by_id(&self, entry_id: LedgerEntryId) -> Option<&LedgerEntry>
pub fn entry_by_id(&self, entry_id: LedgerEntryId) -> Option<&LedgerEntry>
Returns the entry for the given identifier, if any.
Sourcepub fn iter(&self) -> impl Iterator<Item = &LedgerEntry>
pub fn iter(&self) -> impl Iterator<Item = &LedgerEntry>
Returns an iterator over all entries, in insertion order.
Trait Implementations§
Source§impl Default for AppendLedger
impl Default for AppendLedger
Source§fn default() -> AppendLedger
fn default() -> AppendLedger
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AppendLedger
impl RefUnwindSafe for AppendLedger
impl Send for AppendLedger
impl Sync for AppendLedger
impl Unpin for AppendLedger
impl UnsafeUnpin for AppendLedger
impl UnwindSafe for AppendLedger
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