pub trait Store {
// Required methods
fn index(
&mut self,
project_id: &str,
content: &str,
meta: &SessionMeta,
) -> Result<String, Error>;
fn search(
&mut self,
project_id: &str,
query: &str,
limit: usize,
) -> Result<Vec<SearchResult>, Error>;
fn delete_project(&mut self, project_id: &str) -> Result<usize, Error>;
fn cleanup_stale(
&mut self,
project_id: &str,
max_age_secs: i64,
) -> Result<usize, Error>;
}Expand description
Backend for storing and searching indexed command output.
Implementations can use different storage mechanisms (SQLite, Vipune, etc.) to persist and retrieve command output for later recall.
Required Methods§
Sourcefn index(
&mut self,
project_id: &str,
content: &str,
meta: &SessionMeta,
) -> Result<String, Error>
fn index( &mut self, project_id: &str, content: &str, meta: &SessionMeta, ) -> Result<String, Error>
Index a command output entry for later retrieval.
Returns the unique identifier of the indexed entry.
Sourcefn search(
&mut self,
project_id: &str,
query: &str,
limit: usize,
) -> Result<Vec<SearchResult>, Error>
fn search( &mut self, project_id: &str, query: &str, limit: usize, ) -> Result<Vec<SearchResult>, Error>
Search for indexed entries matching a query.
Returns up to limit results ordered by relevance.
Sourcefn delete_project(&mut self, project_id: &str) -> Result<usize, Error>
fn delete_project(&mut self, project_id: &str) -> Result<usize, Error>
Delete all entries for a project.
Removes every entry the backend can enumerate under project_id,
regardless of the session that indexed it, including entries with NULL
or unparseable metadata. Completeness is backend-dependent:
SqliteStoredeletes by the sameprojectpredicate thatsearchuses, sorecallfinds nothing afterwards.VipuneStoreenumerates the project with repeatedlistcalls capped at 10,000 entries, and its search is similarity-based. Completeness for very large projects is therefore backend-dependent and bounded by that stopping rule (see theVipuneStoreimpl docs instore_vipune.rs). A failed individual deletion is reported as an error.
Returns the number of entries deleted.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".