pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
Sourcepub fn write_event(
&self,
action: &str,
key: &str,
scope: &str,
tokens: i32,
) -> Result<()>
pub fn write_event( &self, action: &str, key: &str, scope: &str, tokens: i32, ) -> Result<()>
Write an event to the live activity feed.
action: “save” | “search” | “inject” | “hit”
key: memory key, query string, or count description
scope: scope path
tokens: tokens injected (non-zero only for “inject” action)
Sourcepub fn recent_events(&self, limit: i32) -> Result<Vec<EventLogEntry>>
pub fn recent_events(&self, limit: i32) -> Result<Vec<EventLogEntry>>
Return the N most recent events, newest first.
Sourcepub fn events_today_summary(&self) -> Result<(i64, i64, i64, i64)>
pub fn events_today_summary(&self) -> Result<(i64, i64, i64, i64)>
Counts for today: (saves, injections, searches, tokens_injected).
Sourcepub fn purge_old_events(&self, days: u32) -> Result<u64>
pub fn purge_old_events(&self, days: u32) -> Result<u64>
Purge events older than days days. Called by the maintenance scheduler.
Source§impl Store
impl Store
pub fn save(&self, params: SaveParams) -> Result<SaveAction>
pub fn get(&self, id: i64) -> Result<Memory>
pub fn search(&self, params: SearchParams) -> Result<Vec<SearchResult>>
pub fn delete_scope(&self, scope: &str, hard: bool) -> Result<usize>
pub fn delete(&self, key: &str, scope: Option<&str>, hard: bool) -> Result<bool>
pub fn delete_by_id(&self, id: i64, hard: bool) -> Result<bool>
pub fn update( &self, id: i64, key: Option<&str>, value: Option<&str>, tags: Option<Vec<String>>, ) -> Result<Memory>
pub fn list( &self, scope: Option<&str>, source_type: Option<&SourceType>, limit: Option<i32>, ) -> Result<Vec<Memory>>
pub fn list_all( &self, scope: Option<&str>, source_type: Option<&SourceType>, ) -> Result<Vec<Memory>>
pub fn context( &self, scope: Option<&str>, limit: Option<i32>, ) -> Result<Vec<Memory>>
pub fn apply_confidence_decay(&self) -> Result<u32>
Sourcepub fn purge_soft_deleted(&self, retention_days: u32) -> Result<u32>
pub fn purge_soft_deleted(&self, retention_days: u32) -> Result<u32>
Hard-delete soft-deleted memories older than retention_days days.
Returns the number of rows deleted.
Sourcepub fn distinct_scopes(&self) -> Result<Vec<String>>
pub fn distinct_scopes(&self) -> Result<Vec<String>>
Return sorted distinct scopes of non-deleted memories.
Sourcepub fn maintenance_status(&self) -> Result<MaintenanceStatus>
pub fn maintenance_status(&self) -> Result<MaintenanceStatus>
Return a snapshot of maintenance-relevant statistics.
pub fn list_by_source_commit(&self) -> Result<Vec<Memory>>
Source§impl Store
impl Store
pub fn record_injection( &self, memory_ids: &[i64], tokens_per_memory: i32, ) -> Result<()>
pub fn record_hit(&self, memory_id: i64) -> Result<()>
pub fn record_hit_batch(&self, memory_ids: &[i64]) -> Result<()>
Sourcepub fn cumulative_stats(&self) -> Result<TokenStats>
pub fn cumulative_stats(&self) -> Result<TokenStats>
Cumulative token stats across all time (from the metrics table).
pub fn dedup_total(&self) -> Result<i64>
pub fn revision_total(&self) -> Result<i64>
pub fn low_roi_count(&self) -> Result<i64>
pub fn get_metrics(&self) -> Result<Vec<MemoryMetric>>
Source§impl Store
impl Store
pub fn add_relation( &self, source_id: i64, target_id: i64, rel_type: RelationType, ) -> Result<i64>
pub fn get_relations(&self, memory_id: i64) -> Result<Vec<Relation>>
pub fn superseded_ids(&self) -> Result<HashSet<i64>>
Source§impl Store
impl Store
pub fn open( path: &str, config: Config, passphrase: Option<&str>, ) -> Result<Self>
pub fn open_in_memory() -> Result<Self>
pub fn open_in_memory_with_config(config: Config) -> Result<Self>
pub fn config(&self) -> &Config
pub fn get_metadata(&self, key: &str) -> Result<Option<String>>
pub fn set_metadata(&self, key: &str, value: &str) -> Result<()>
pub fn schema_version(&self) -> Result<i64>
Sourcepub fn is_encrypted(path: &str) -> bool
pub fn is_encrypted(path: &str) -> bool
Check if a database file is encrypted (requires encryption feature to detect).