Skip to main content

Store

Trait Store 

Source
pub trait Store:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Item>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn put<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        key: &'life2 str,
        value: Value,
        index: Option<Vec<String>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn search<'life0, 'async_trait>(
        &'life0 self,
        query: SearchQuery,
    ) -> Pin<Box<dyn Future<Output = Result<SearchResult, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn list_namespaces<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prefix: Option<&'life1 str>,
        suffix: Option<&'life2 str>,
        max_depth: Option<usize>,
        limit: Option<usize>,
        offset: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn batch<'life0, 'async_trait>(
        &'life0 self,
        ops: Vec<StoreOp>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StoreResult>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Store trait for cross-thread long-term memory

Provides hierarchical namespace key-value storage independent of checkpoint and shared across all threads and graph executions.

Note: This trait cannot implement Debug as it’s an async trait intended for dynamic dispatch via trait objects.

Required Methods§

Source

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

Get item from store

§Arguments
  • namespace - Namespace path
  • key - Item key within namespace
Source

fn put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, namespace: &'life1 str, key: &'life2 str, value: Value, index: Option<Vec<String>>, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Put item into store

§Arguments
  • namespace - Namespace path
  • key - Item key within namespace
  • value - Item value
  • index - Optional index fields for vector search
Source

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

Delete item from store

§Arguments
  • namespace - Namespace path
  • key - Item key within namespace
Source

fn search<'life0, 'async_trait>( &'life0 self, query: SearchQuery, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Search items with filtering and optional vector search

§Arguments
  • query - Search query
Source

fn list_namespaces<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prefix: Option<&'life1 str>, suffix: Option<&'life2 str>, max_depth: Option<usize>, limit: Option<usize>, offset: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

List namespaces

§Arguments
  • prefix - Optional prefix filter
  • suffix - Optional suffix filter
  • max_depth - Optional maximum depth
  • limit - Optional result limit
  • offset - Optional offset
Source

fn batch<'life0, 'async_trait>( &'life0 self, ops: Vec<StoreOp>, ) -> Pin<Box<dyn Future<Output = Result<Vec<StoreResult>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Execute batch operations

§Arguments
  • ops - List of operations to execute

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§