pub trait MemoryBackend:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn put<'a>(
&'a self,
content: &'a str,
kind: &'a str,
subject: &'a str,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>;
fn search<'a>(
&'a self,
query: &'a str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>;
fn list<'a>(
&'a self,
subject: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>;
fn delete<'a>(
&'a self,
id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), ToolError>> + Send + 'a>>;
// Provided methods
fn memory_info(&self) -> Option<String> { ... }
fn trigger_consolidation(&self) -> Option<String> { ... }
fn trigger_harmonize(&self) -> Option<String> { ... }
fn clear_all<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<usize, ToolError>> + Send + 'a>> { ... }
fn enqueue_consolidation<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>> { ... }
}Expand description
Memory backend for the memory_* tools. The composition root implements
this, bridging to oxi_sdk::ports::MemoryStore + EmbeddingProvider.
Required Methods§
Sourcefn put<'a>(
&'a self,
content: &'a str,
kind: &'a str,
subject: &'a str,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>
fn put<'a>( &'a self, content: &'a str, kind: &'a str, subject: &'a str, ) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>
Store a memory item, returning its new ID.
Sourcefn search<'a>(
&'a self,
query: &'a str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>
fn search<'a>( &'a self, query: &'a str, k: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryItem>, ToolError>> + Send + 'a>>
Semantic-search stored memories, returning up to k matches.
Provided Methods§
Sourcefn memory_info(&self) -> Option<String>
fn memory_info(&self) -> Option<String>
Human-readable memory status (None if not supported by this backend).
Sourcefn trigger_consolidation(&self) -> Option<String>
fn trigger_consolidation(&self) -> Option<String>
Trigger sleep consolidation, returning a status message.
Sourcefn trigger_harmonize(&self) -> Option<String>
fn trigger_harmonize(&self) -> Option<String>
Trigger SHMR harmonization, returning a status message.
Sourcefn clear_all<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<usize, ToolError>> + Send + 'a>>
fn clear_all<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<usize, ToolError>> + Send + 'a>>
Delete every memory item in the backend. Returns the number of items removed.
The default implementation is unsupported: it returns an honest error rather than silently deleting zero rows. Backends that can perform a true bulk erase must override this method; backends without a list-all subject primitive must surface that limitation rather than guess.
This is a destructive operation; the /memory clear slash
command requires an explicit confirmation flag before invoking.
Sourcefn enqueue_consolidation<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>
fn enqueue_consolidation<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>
Force a consolidation (rebuild) job. Returns a status message
describing what was dispatched, or Err when the backend has
no in-process capability to enqueue work.
Default: Err (“not supported”). Backends that expose
consolidation via the engine (e.g. Mnemopi sleep) should
override and run the real operation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".