Skip to main content

StateStore

Trait StateStore 

Source
pub trait StateStore: Send + Sync {
    // Required methods
    fn get(
        &self,
        key: &str,
    ) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send;
    fn set(
        &self,
        key: &str,
        value: &[u8],
        ttl_secs: Option<u64>,
    ) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send;
    fn delete(&self, key: &str) -> impl Future<Output = Result<()>> + Send;
}
Expand description

The StateStore trait defines the behavior storing and retrieving train state.

Required Methods§

Source

fn get(&self, key: &str) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send

Retrieve a previously stored value from the state store.

Source

fn set( &self, key: &str, value: &[u8], ttl_secs: Option<u64>, ) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send

Store a value in the state store.

Source

fn delete(&self, key: &str) -> impl Future<Output = Result<()>> + Send

Delete a value from the state store.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§