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§
Sourcefn put(
&self,
key: &str,
seq: u64,
envelope: &Value,
) -> Result<PutOutcome, StoreError>
fn put( &self, key: &str, seq: u64, envelope: &Value, ) -> Result<PutOutcome, StoreError>
Compare-and-set write: seq must exceed the stored one.
Sourcefn get(&self, key: &str, seq: Option<u64>) -> Result<Option<Value>, StoreError>
fn get(&self, key: &str, seq: Option<u64>) -> Result<Option<Value>, StoreError>
The latest record (or the pinned seq if the store keeps history).
Sourcefn list(&self, prefix: &str) -> Result<Vec<KeySeq>, StoreError>
fn list(&self, prefix: &str) -> Result<Vec<KeySeq>, StoreError>
Keys under prefix (optional; Unsupported is a legal answer).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".