pub struct SessionStore { /* private fields */ }Expand description
SQLite FTS5-backed persistent session and cache store.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open an existing database at path. Returns an error if the file does
not exist or cannot be opened.
Sourcepub fn open_or_create(path: &Path) -> Result<Self>
pub fn open_or_create(path: &Path) -> Result<Self>
Open the database at path, creating it if it does not exist.
If the database is corrupted, a fresh database is created at the same
path and a warning is logged to stderr.
Sourcepub fn save_session(&self, session: &SessionState) -> Result<SessionId>
pub fn save_session(&self, session: &SessionState) -> Result<SessionId>
Persist a session. Returns the session id.
Sourcepub fn load_session(&self, id: SessionId) -> Result<SessionState>
pub fn load_session(&self, id: SessionId) -> Result<SessionState>
Load a session by id.
Sourcepub fn search(&self, query: &str) -> Result<Vec<SessionSummary>>
pub fn search(&self, query: &str) -> Result<Vec<SessionSummary>>
Full-text search using FTS5 (porter stemmer, ASCII tokenizer).
Sourcepub fn search_by_date(
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
) -> Result<Vec<SessionSummary>>
pub fn search_by_date( &self, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Result<Vec<SessionSummary>>
Query sessions whose updated_at falls within [from, to].
Sourcepub fn search_by_project(&self, dir: &Path) -> Result<Vec<SessionSummary>>
pub fn search_by_project(&self, dir: &Path) -> Result<Vec<SessionSummary>>
Query sessions whose project_dir matches dir exactly.
Sourcepub fn save_cache_entry(
&self,
hash: &str,
compressed: &CompressedContent,
) -> Result<()>
pub fn save_cache_entry( &self, hash: &str, compressed: &CompressedContent, ) -> Result<()>
Persist a cache entry keyed by content hash.
Sourcepub fn delete_cache_entry(&self, hash: &str) -> Result<()>
pub fn delete_cache_entry(&self, hash: &str) -> Result<()>
Delete a cache entry by content hash.
Sourcepub fn list_cache_entries_lru(&self) -> Result<Vec<(String, u64)>>
pub fn list_cache_entries_lru(&self) -> Result<Vec<(String, u64)>>
Return all cache entries ordered by accessed_at ASC (oldest first),
as (hash, size_bytes) pairs where size_bytes is the byte length of
the stored JSON data.
Sourcepub fn get_cache_entry(&self, hash: &str) -> Result<Option<CompressedContent>>
pub fn get_cache_entry(&self, hash: &str) -> Result<Option<CompressedContent>>
Retrieve a cache entry by content hash, updating accessed_at.