Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
    // Required methods
    fn put(
        &self,
        key: &str,
        seq: u64,
        envelope: &Value,
    ) -> Result<PutOutcome, StoreError>;
    fn get(
        &self,
        key: &str,
        seq: Option<u64>,
    ) -> Result<Option<Value>, StoreError>;
    fn list(&self, prefix: &str) -> Result<Vec<KeySeq>, StoreError>;
    fn delete(&self, key: &str) -> Result<(), StoreError>;
    fn kind(&self) -> &'static str;
}
Expand description

The four-operation store contract. Implementations are Send + Sync so the runtime’s executor pool can call them from any thread; every operation is bounded by the adapter’s timeout, so no store call can wedge a worker.

Required Methods§

Source

fn put( &self, key: &str, seq: u64, envelope: &Value, ) -> Result<PutOutcome, StoreError>

Compare-and-set write: seq must exceed the stored one.

Source

fn get(&self, key: &str, seq: Option<u64>) -> Result<Option<Value>, StoreError>

The latest record (or the pinned seq if the store keeps history).

Source

fn list(&self, prefix: &str) -> Result<Vec<KeySeq>, StoreError>

Keys under prefix (optional; Unsupported is a legal answer).

Source

fn delete(&self, key: &str) -> Result<(), StoreError>

Remove a key (optional; Unsupported ⇒ callers tombstone via put).

Source

fn kind(&self) -> &'static str

The adapter kind (mcp / http / file / memory), for status and metrics.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§