Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        namespace: &'life1 [&'life2 str],
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Item>, SynapticError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        namespace: &'life1 [&'life2 str],
        query: Option<&'life3 str>,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Item>, SynapticError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        namespace: &'life1 [&'life2 str],
        key: &'life3 str,
        value: Value,
    ) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        namespace: &'life1 [&'life2 str],
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn list_namespaces<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prefix: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<String>>, SynapticError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Persistent key-value store trait for cross-invocation state.

Namespaces are hierarchical (represented as slices of strings) and keys are strings within a namespace. Values are arbitrary JSON.

Required Methods§

Source

fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, namespace: &'life1 [&'life2 str], key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Item>, SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Get an item by namespace and key.

Source

fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, namespace: &'life1 [&'life2 str], query: Option<&'life3 str>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Item>, SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Search items within a namespace.

Source

fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, namespace: &'life1 [&'life2 str], key: &'life3 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Put (upsert) an item.

Source

fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, namespace: &'life1 [&'life2 str], key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Delete an item.

Source

fn list_namespaces<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prefix: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<String>>, SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List all namespaces, optionally filtered by prefix.

Implementors§