pub struct ThreadedMessageStore { /* private fields */ }Expand description
Per-thread append-only message store with G-Set CRDT semantics (REQ-300).
Uses HashIndex for O(1) lookup (REQ-309) and deduplication (REQ-310).
Maintains a frontier set per thread for efficient leaf queries.
Implementations§
Source§impl ThreadedMessageStore
impl ThreadedMessageStore
Sourcepub fn append_envelope(
&mut self,
envelope: RedactedEnvelope,
signer: &dyn Signer,
) -> Result<bool, AttestError>
pub fn append_envelope( &mut self, envelope: RedactedEnvelope, signer: &dyn Signer, ) -> Result<bool, AttestError>
Accept a redacted envelope (SPEC-015 REQ-702).
Verifies the envelope’s R4 v2 attestation from its own fields first
(signer embodies verification for the envelope’s sender key), then
places it in the thread its authenticated thread field names —
there is deliberately no thread parameter, so cross-thread injection
of a genuine envelope is a signature failure at the source, not a
policy question. An unverifiable envelope is never stored.
Returns Ok(true) if newly shelved, Ok(false) if an envelope for
this content hash is already present (G-Set dedup, as for messages).
Sourcepub fn append_opened(
&mut self,
envelope: OpenedEnvelope,
signer: &dyn Signer,
) -> Result<bool, OpenedError>
pub fn append_opened( &mut self, envelope: OpenedEnvelope, signer: &dyn Signer, ) -> Result<bool, OpenedError>
Accept an opened envelope (SPEC-017 REQ-813).
Verifies the v3 root-signature and every field-opening from the
envelope’s own fields first (signer embodies verification for the
sender key), then shelves it under its typed root, placed in the
thread its authenticated Thread opening names. As with
Self::append_envelope there is deliberately no thread parameter,
so cross-thread injection of a genuine envelope is a signature/opening
failure at the source, not a policy question; an envelope that does
not open its Thread leaf cannot be placed (fail closed).
Returns Ok(true) if newly shelved, Ok(false) if an opened
envelope for this root is already present (G-Set dedup).
Trait Implementations§
Source§impl Clone for ThreadedMessageStore
impl Clone for ThreadedMessageStore
Source§impl Debug for ThreadedMessageStore
impl Debug for ThreadedMessageStore
Source§impl Default for ThreadedMessageStore
impl Default for ThreadedMessageStore
Source§impl MessageStore for ThreadedMessageStore
impl MessageStore for ThreadedMessageStore
Source§fn lookup(&self, hash: &ContentHash) -> Option<&Message>
fn lookup(&self, hash: &ContentHash) -> Option<&Message>
Source§fn lookup_in_thread(
&self,
hash: &ContentHash,
thread: &ThreadId,
) -> Option<&Message>
fn lookup_in_thread( &self, hash: &ContentHash, thread: &ThreadId, ) -> Option<&Message>
Source§fn contains(&self, hash: &ContentHash, thread: &ThreadId) -> bool
fn contains(&self, hash: &ContentHash, thread: &ThreadId) -> bool
Source§fn append(
&mut self,
hash: ContentHash,
thread: ThreadId,
message: Message,
) -> bool
fn append( &mut self, hash: ContentHash, thread: ThreadId, message: Message, ) -> bool
false if the hash already exists
(deduplication per REQ-310). Returns true if newly inserted.Source§fn frontier(&self, thread: &ThreadId) -> Vec<&ContentHash>
fn frontier(&self, thread: &ThreadId) -> Vec<&ContentHash>
:caused-by in the same thread.Source§fn causal_closure(
&self,
hash: &ContentHash,
thread: &ThreadId,
) -> Vec<ContentHash>
fn causal_closure( &self, hash: &ContentHash, thread: &ThreadId, ) -> Vec<ContentHash>
:caused-by links back to root(s).