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_by_session(
        &mut self,
        project_id: &str,
        session_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_by_session( &mut self, project_id: &str, session_id: &str, ) -> Result<usize, Error>

Delete all entries for a specific session.

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.

Implementors§