Skip to main content

MessageStore

Trait MessageStore 

Source
pub trait MessageStore {
    // Required methods
    fn lookup(&self, hash: &ContentHash) -> Option<&Message>;
    fn lookup_in_thread(
        &self,
        hash: &ContentHash,
        thread: &ThreadId,
    ) -> Option<&Message>;
    fn contains(&self, hash: &ContentHash, thread: &ThreadId) -> bool;
    fn append(
        &mut self,
        hash: ContentHash,
        thread: ThreadId,
        message: Message,
    ) -> bool;
    fn frontier(&self, thread: &ThreadId) -> Vec<&ContentHash>;
    fn causal_closure(
        &self,
        hash: &ContentHash,
        thread: &ThreadId,
    ) -> Vec<ContentHash>;

    // Provided methods
    fn materialized_positions(&self) -> Option<&MaterializedPositions> { ... }
    fn envelope_in_thread(
        &self,
        hash: &ContentHash,
        thread: &ThreadId,
    ) -> Option<&RedactedEnvelope> { ... }
    fn opened_in_thread(
        &self,
        hash: &ContentHash,
        thread: &ThreadId,
    ) -> Option<&OpenedEnvelope> { ... }
}

Required Methods§

Source

fn lookup(&self, hash: &ContentHash) -> Option<&Message>

Look up a message by content hash across all threads.

Source

fn lookup_in_thread( &self, hash: &ContentHash, thread: &ThreadId, ) -> Option<&Message>

Look up a message by content hash within a specific thread (ADR-008).

Source

fn contains(&self, hash: &ContentHash, thread: &ThreadId) -> bool

Check whether a content hash exists in the given thread.

Source

fn append( &mut self, hash: ContentHash, thread: ThreadId, message: Message, ) -> bool

Append a message to a thread. Returns false if the hash already exists (deduplication per REQ-310). Returns true if newly inserted.

Source

fn frontier(&self, thread: &ThreadId) -> Vec<&ContentHash>

Returns the frontier (leaf messages) of a thread — messages not referenced by any other message’s :caused-by in the same thread.

Source

fn causal_closure( &self, hash: &ContentHash, thread: &ThreadId, ) -> Vec<ContentHash>

Returns the causal closure (principal ideal) of a message — all messages reachable by transitively following :caused-by links back to root(s).

Provided Methods§

Source

fn materialized_positions(&self) -> Option<&MaterializedPositions>

Optional independently admitted or snapshot-attested native position cache. Implementations must bind installation to the same code/root/thread. The resolver checks that binding again; default None preserves legacy behavior.

Source

fn envelope_in_thread( &self, hash: &ContentHash, thread: &ThreadId, ) -> Option<&RedactedEnvelope>

Look up a redacted envelope by the content hash of the message it redacts, scoped to the envelope’s authenticated thread (SPEC-015 REQ-702).

This is the safety-level seam: protocol::verify_causal falls back to it when a :caused-by reference has no full message, reading only the envelope’s authenticated performative type. The completion-level occupant fan-in (projection.rs, REQ-618) deliberately never consults it (REQ-703).

Default: no envelope shelf (stores predating SPEC-015 change nothing and keep their exact v1 behaviour).

Source

fn opened_in_thread( &self, hash: &ContentHash, thread: &ThreadId, ) -> Option<&OpenedEnvelope>

Look up an opened envelope by the typed content root of the message it opens, scoped to the envelope’s authenticated Thread opening (SPEC-017 REQ-813).

The Stage-3 native-openings counterpart of Self::envelope_in_thread: protocol::verify_causal falls back to it for the safety-level predecessor type when a :caused-by reference has no full message, reading only the envelope’s authenticated Performative opening. The completion-level occupant fan-in (projection.rs, REQ-703) never consults it — that boundary is preserved exactly as for redacted envelopes.

Default: no opened shelf (stores that never accept opened envelopes keep their exact behaviour).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§