pub trait SyncStore {
// Required methods
fn account_id(&self) -> [u8; 32];
fn snapshot(&self) -> Result<Vec<([u8; 32], Vec<u8>)>>;
fn ingest(&mut self, signed_bytes: &[u8]) -> Result<Ingested>;
}Expand description
The store side of a session: what a peer offers and where received entries land. Implemented over the op log for production and over an in-memory map for tests.
Required Methods§
Sourcefn account_id(&self) -> [u8; 32]
fn account_id(&self) -> [u8; 32]
The account this session is scoped to. A peer whose hello names a different account is a misdirected connection and the session aborts.
Sourcefn snapshot(&self) -> Result<Vec<([u8; 32], Vec<u8>)>>
fn snapshot(&self) -> Result<Vec<([u8; 32], Vec<u8>)>>
Every held account-log entry as (dedup_key, signed_bytes), read ONCE at session start. The
key is the SIGNED-envelope hash (sha256(signed_bytes)), NOT the entry_hash — two envelopes
can share an entry_hash but differ in signature, and the wire must treat them as distinct or
a peer holding one would suppress the other. Snapshotting up front keeps what we send
independent of what we concurrently ingest, so the two session halves never contend.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".