Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub fn save(&self, params: SaveParams) -> Result<SaveAction>

Source

pub fn get(&self, id: i64) -> Result<Memory>

Source

pub fn search(&self, params: SearchParams) -> Result<Vec<SearchResult>>

Source

pub fn delete_scope(&self, scope: &str, hard: bool) -> Result<usize>

Source

pub fn delete(&self, key: &str, scope: Option<&str>, hard: bool) -> Result<bool>

Source

pub fn delete_by_id(&self, id: i64, hard: bool) -> Result<bool>

Source

pub fn update( &self, id: i64, key: Option<&str>, value: Option<&str>, tags: Option<Vec<String>>, ) -> Result<Memory>

Source

pub fn list( &self, scope: Option<&str>, source_type: Option<&SourceType>, limit: Option<i32>, ) -> Result<Vec<Memory>>

Source

pub fn list_all( &self, scope: Option<&str>, source_type: Option<&SourceType>, ) -> Result<Vec<Memory>>

Source

pub fn context( &self, scope: Option<&str>, limit: Option<i32>, ) -> Result<Vec<Memory>>

Source

pub fn apply_confidence_decay(&self) -> Result<u32>

Source

pub fn search_by_tags( &self, tags: &[&str], scope: Option<&str>, limit: i32, ) -> Result<Vec<SearchResult>>

Source

pub fn list_by_source_commit(&self) -> Result<Vec<Memory>>

Source§

impl Store

Source

pub fn log_access( &self, action: &str, query: Option<&str>, memory_ids: &[i64], ) -> Result<()>

Source

pub fn record_injection(&self, memory_ids: &[i64]) -> Result<()>

Source

pub fn record_hit(&self, memory_id: i64) -> Result<()>

Source

pub fn record_hit_batch(&self, memory_ids: &[i64]) -> Result<()>

Source

pub fn cumulative_stats(&self) -> Result<TokenStats>

Cumulative token stats across all time.

Source

pub fn session_token_stats(&self, session_id: &str) -> Result<TokenStats>

Token stats for a specific session (by time range from session start).

Source

pub fn access_log_stats(&self) -> Result<Vec<(String, i64)>>

Source

pub fn access_log_total(&self) -> Result<i64>

Source

pub fn dedup_total(&self) -> Result<i64>

Source

pub fn revision_total(&self) -> Result<i64>

Source

pub fn low_roi_count(&self) -> Result<i64>

Source

pub fn top_searches(&self, limit: i32) -> Result<Vec<(String, i64)>>

Source

pub fn get_metrics(&self) -> Result<Vec<MemoryMetric>>

Source§

impl Store

Source

pub fn session_start( &self, project: &str, directory: Option<&str>, ) -> Result<Session>

Source

pub fn session_end( &self, session_id: &str, summary: Option<&str>, ) -> Result<Session>

Source

pub fn recent_sessions(&self, limit: i32) -> Result<Vec<Session>>

Source

pub fn end_active_sessions( &self, project: Option<&str>, summary: Option<&str>, ) -> Result<usize>

End all active sessions, optionally filtered by project name. Returns the number of sessions ended.

Source§

impl Store

Source

pub fn add_relation( &self, source_id: i64, target_id: i64, rel_type: RelationType, ) -> Result<i64>

Source

pub fn get_relations(&self, memory_id: i64) -> Result<Vec<Relation>>

Source

pub fn superseded_ids(&self) -> Result<HashSet<i64>>

Source§

impl Store

Source

pub fn open( path: &str, config: Config, passphrase: Option<&str>, ) -> Result<Self>

Source

pub fn open_in_memory() -> Result<Self>

Source

pub fn open_in_memory_with_config(config: Config) -> Result<Self>

Source

pub fn config(&self) -> &Config

Source

pub fn get_metadata(&self, key: &str) -> Result<Option<String>>

Source

pub fn set_metadata(&self, key: &str, value: &str) -> Result<()>

Source

pub fn schema_version(&self) -> Result<i64>

Source

pub fn is_encrypted(path: &str) -> bool

Check if a database file is encrypted (requires encryption feature to detect).

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl !Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.