Skip to main content

MemoryStore

Trait MemoryStore 

Source
pub trait MemoryStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn put(
        &self,
        entry: MemoryEntry,
    ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>;
    fn list(
        &self,
        subject: &str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, SdkError>> + Send + '_>>;

    // Provided methods
    fn search(
        &self,
        _query: &[f32],
        _k: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, SdkError>> + Send + '_>> { ... }
    fn delete(
        &self,
        _id: &str,
    ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>> { ... }
}
Expand description

Episodic / semantic / procedural memory store with optional vector search.

Required Methods§

Source

fn put( &self, entry: MemoryEntry, ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>

Persist a memory entry.

Source

fn list( &self, subject: &str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, SdkError>> + Send + '_>>

List entries for a subject.

Provided Methods§

Source

fn search( &self, _query: &[f32], _k: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, SdkError>> + Send + '_>>

Semantic search by embedding (cosine similarity). Returns top-k.

Source

fn delete( &self, _id: &str, ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>

Delete the entry with the given id.

Default returns SdkError::PortNotConfigured — stores that cannot delete (e.g. append-only audit logs) keep this default. Backends that support deletion override it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§