pub struct InMemoryStore { /* private fields */ }Expand description
Thread-safe in-memory implementation of Store.
Supports optional embedding-based semantic search via with_embeddings.
Implementations§
Source§impl InMemoryStore
impl InMemoryStore
pub fn new() -> Self
Sourcepub fn with_embeddings(self, embeddings: Arc<dyn Embeddings>) -> Self
pub fn with_embeddings(self, embeddings: Arc<dyn Embeddings>) -> Self
Enable embedding-based semantic search.
When configured, Store::search() with a query will use embedding
similarity instead of substring matching. Items are ranked by cosine
similarity and Item::score is populated.
Trait Implementations§
Source§impl Default for InMemoryStore
impl Default for InMemoryStore
Source§impl Store for InMemoryStore
impl Store for InMemoryStore
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,
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,
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,
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,
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,
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.
Auto Trait Implementations§
impl Freeze for InMemoryStore
impl !RefUnwindSafe for InMemoryStore
impl Send for InMemoryStore
impl Sync for InMemoryStore
impl Unpin for InMemoryStore
impl UnsafeUnpin for InMemoryStore
impl !UnwindSafe for InMemoryStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more