pub struct InMemoryMemoryProvenanceStore { /* private fields */ }Expand description
Thread-safe in-memory MemoryProvenanceStore. Useful for tests and
for ephemeral deployments; production deployments should use the
SQLite-backed store in chio-store-sqlite.
Implementations§
Trait Implementations§
Source§impl Default for InMemoryMemoryProvenanceStore
impl Default for InMemoryMemoryProvenanceStore
Source§fn default() -> InMemoryMemoryProvenanceStore
fn default() -> InMemoryMemoryProvenanceStore
Returns the “default value” for a type. Read more
Source§impl MemoryProvenanceStore for InMemoryMemoryProvenanceStore
impl MemoryProvenanceStore for InMemoryMemoryProvenanceStore
Source§fn append(
&self,
input: MemoryProvenanceAppend,
) -> Result<MemoryProvenanceEntry, MemoryProvenanceError>
fn append( &self, input: MemoryProvenanceAppend, ) -> Result<MemoryProvenanceEntry, MemoryProvenanceError>
Append a new entry, computing the chain linkage atomically.
Source§fn get_entry(
&self,
entry_id: &str,
) -> Result<Option<MemoryProvenanceEntry>, MemoryProvenanceError>
fn get_entry( &self, entry_id: &str, ) -> Result<Option<MemoryProvenanceEntry>, MemoryProvenanceError>
Fetch an entry by its unique id. Returns
Ok(None) when the id
is absent; consumers should treat that as
UnverifiedReason::NoProvenance when it happens during a read.Source§fn latest_for_key(
&self,
store: &str,
key: &str,
) -> Result<Option<MemoryProvenanceEntry>, MemoryProvenanceError>
fn latest_for_key( &self, store: &str, key: &str, ) -> Result<Option<MemoryProvenanceEntry>, MemoryProvenanceError>
Fetch the most-recent entry for a
(store, key) pair, or
Ok(None) when no entry has ever been appended for that key.Source§fn verify_entry(
&self,
entry_id: &str,
) -> Result<ProvenanceVerification, MemoryProvenanceError>
fn verify_entry( &self, entry_id: &str, ) -> Result<ProvenanceVerification, MemoryProvenanceError>
Verify a specific entry: recompute its hash, confirm its
prev_hash matches the entry that sits immediately before it
(or the genesis marker for entry #1), and return
ProvenanceVerification::Verified when everything checks out.Source§fn chain_digest(&self) -> Result<String, MemoryProvenanceError>
fn chain_digest(&self) -> Result<String, MemoryProvenanceError>
Aggregate digest of the chain – the
hash of the tail entry,
or MEMORY_PROVENANCE_GENESIS_PREV_HASH when the chain is
empty. Useful for embedding into receipts as a snapshot marker.Auto Trait Implementations§
impl !Freeze for InMemoryMemoryProvenanceStore
impl RefUnwindSafe for InMemoryMemoryProvenanceStore
impl Send for InMemoryMemoryProvenanceStore
impl Sync for InMemoryMemoryProvenanceStore
impl Unpin for InMemoryMemoryProvenanceStore
impl UnsafeUnpin for InMemoryMemoryProvenanceStore
impl UnwindSafe for InMemoryMemoryProvenanceStore
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