Skip to main content

Store

Trait Store 

Source
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§

Source

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.

Source

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.

Source

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:

  • SqliteStore deletes by the same project predicate that search uses, so recall finds nothing afterwards.
  • VipuneStore enumerates the project with repeated list calls 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 the VipuneStore impl docs in store_vipune.rs). A failed individual deletion is reported as an error.

Returns the number of entries deleted.

Source

fn cleanup_stale( &mut self, project_id: &str, max_age_secs: i64, ) -> Result<usize, Error>

Delete entries older than max_age_secs seconds.

Returns the number of entries deleted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§