pub trait Store: Send + Sync {
// Required methods
fn put<'a>(
&'a self,
namespace: &'a [&'a str],
key: &'a str,
value: Value,
) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + 'a>>;
fn get<'a>(
&'a self,
namespace: &'a [&'a str],
key: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoreItem>, ReactError>> + Send + 'a>>;
fn search<'a>(
&'a self,
namespace: &'a [&'a str],
query: &'a str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>>;
fn delete<'a>(
&'a self,
namespace: &'a [&'a str],
key: &'a str,
) -> Pin<Box<dyn Future<Output = Result<bool, ReactError>> + Send + 'a>>;
fn list_namespaces<'a>(
&'a self,
prefix: Option<&'a [&'a str]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<String>>, ReactError>> + Send + 'a>>;
fn list<'a>(
&'a self,
namespace: &'a [&'a str],
) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>>;
// Provided method
fn search_with<'a>(
&'a self,
namespace: &'a [&'a str],
query: SearchQuery<'a>,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>> { ... }
}Expand description
Unified storage interface for long-term memory
Required Methods§
Sourcefn put<'a>(
&'a self,
namespace: &'a [&'a str],
key: &'a str,
value: Value,
) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + 'a>>
fn put<'a>( &'a self, namespace: &'a [&'a str], key: &'a str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + 'a>>
Write or update a record (upsert)
Sourcefn get<'a>(
&'a self,
namespace: &'a [&'a str],
key: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoreItem>, ReactError>> + Send + 'a>>
fn get<'a>( &'a self, namespace: &'a [&'a str], key: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<StoreItem>, ReactError>> + Send + 'a>>
Exact fetch by key
Sourcefn search<'a>(
&'a self,
namespace: &'a [&'a str],
query: &'a str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>>
fn search<'a>( &'a self, namespace: &'a [&'a str], query: &'a str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>>
Keyword search, returns at most limit items (sorted by relevance)
Sourcefn delete<'a>(
&'a self,
namespace: &'a [&'a str],
key: &'a str,
) -> Pin<Box<dyn Future<Output = Result<bool, ReactError>> + Send + 'a>>
fn delete<'a>( &'a self, namespace: &'a [&'a str], key: &'a str, ) -> Pin<Box<dyn Future<Output = Result<bool, ReactError>> + Send + 'a>>
Delete the specified key, returns whether it existed and was deleted
Provided Methods§
Sourcefn search_with<'a>(
&'a self,
namespace: &'a [&'a str],
query: SearchQuery<'a>,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>>
fn search_with<'a>( &'a self, namespace: &'a [&'a str], query: SearchQuery<'a>, ) -> Pin<Box<dyn Future<Output = Result<Vec<StoreItem>, ReactError>> + Send + 'a>>
Unified search entry point.
By default only supports keyword search; semantic/hybrid search must be explicitly overridden by concrete implementations.