pub struct MemoryStore { /* private fields */ }Implementations§
Source§impl MemoryStore
impl MemoryStore
pub fn conn(&self) -> &Connection
pub fn open<P: AsRef<Path>>(path: P) -> SqlResult<Self>
pub fn open_in_memory() -> SqlResult<Self>
pub fn remember_fact( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, ) -> SqlResult<i64>
pub fn remember_fact_full( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>
pub fn remember_fact_ns( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>
Sourcepub fn upsert_fact(
&self,
subject: &str,
relation: &str,
object: &str,
embedding: Option<&[f32]>,
tags: &[String],
source: Option<&str>,
session_id: Option<&str>,
channel: Option<&str>,
) -> SqlResult<(i64, bool)>
pub fn upsert_fact( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<(i64, bool)>
Upsert a fact: if a fact with the same subject+relation exists in the same namespace,
update its object (and embedding/tags). Otherwise insert a new fact.
Returns (id, was_updated).
pub fn upsert_fact_ns( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<(i64, bool)>
pub fn remember_episode( &self, text: &str, embedding: Option<&[f32]>, ) -> SqlResult<i64>
pub fn remember_episode_full( &self, text: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>
pub fn remember_episode_ns( &self, text: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>
pub fn all_memories_with_text(&self) -> SqlResult<Vec<(MemoryRecord, String)>>
pub fn all_memories_with_text_ns( &self, namespace: &str, ) -> SqlResult<Vec<(MemoryRecord, String)>>
pub fn all_memories_with_text_filtered_by_tag( &self, tag: &str, ) -> SqlResult<Vec<(MemoryRecord, String)>>
pub fn all_memories_with_text_filtered_by_tag_ns( &self, tag: &str, namespace: &str, ) -> SqlResult<Vec<(MemoryRecord, String)>>
pub fn touch_memory_with_strength( &self, id: i64, strength: f64, now: DateTime<Utc>, ) -> SqlResult<()>
pub fn get_memory(&self, id: i64) -> SqlResult<Option<MemoryRecord>>
pub fn decay_all( &self, decay_factor: f64, half_life_hours: f64, ) -> SqlResult<usize>
pub fn decay_all_ns( &self, decay_factor: f64, half_life_hours: f64, namespace: &str, ) -> SqlResult<usize>
pub fn forget_by_subject(&self, subject: &str) -> SqlResult<usize>
pub fn forget_by_subject_ns( &self, subject: &str, namespace: &str, ) -> SqlResult<usize>
pub fn forget_by_id(&self, id: &str) -> SqlResult<usize>
pub fn forget_older_than(&self, duration: Duration) -> SqlResult<usize>
pub fn forget_older_than_ns( &self, duration: Duration, namespace: &str, ) -> SqlResult<usize>
pub fn memories_missing_embeddings(&self) -> SqlResult<Vec<MemoryRecord>>
pub fn update_embedding(&self, id: i64, embedding: &[f32]) -> SqlResult<()>
pub fn all_memories(&self) -> SqlResult<Vec<MemoryRecord>>
pub fn all_memories_ns(&self, namespace: &str) -> SqlResult<Vec<MemoryRecord>>
pub fn import_fact( &self, subject: &str, relation: &str, object: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>
pub fn import_fact_ns( &self, subject: &str, relation: &str, object: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>
pub fn import_episode( &self, text: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>
pub fn import_episode_ns( &self, text: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>
Update tags on an existing memory.
Sourcepub fn update_importance(&self, id: i64, importance: f64) -> SqlResult<()>
pub fn update_importance(&self, id: i64, importance: f64) -> SqlResult<()>
Update the importance score of a memory.
Sourcepub fn archive_memory(&self, id: i64) -> SqlResult<()>
pub fn archive_memory(&self, id: i64) -> SqlResult<()>
Set strength to zero (archive) for a memory.
Sourcepub fn delete_memory(&self, id: i64) -> SqlResult<()>
pub fn delete_memory(&self, id: i64) -> SqlResult<()>
Delete a memory by numeric ID.
Sourcepub fn all_embeddings(&self) -> SqlResult<Vec<(i64, Vec<f32>)>>
pub fn all_embeddings(&self) -> SqlResult<Vec<(i64, Vec<f32>)>>
Fetch all memory IDs with their embeddings for dedup similarity checks.
pub fn all_embeddings_ns( &self, namespace: &str, ) -> SqlResult<Vec<(i64, Vec<f32>)>>
Sourcepub fn reinforce_memory(&self, id: i64, boost: f64) -> SqlResult<()>
pub fn reinforce_memory(&self, id: i64, boost: f64) -> SqlResult<()>
Reinforce an existing memory’s strength (clamped to 1.0) and bump access count.
Sourcepub fn facts_involving(&self, entity: &str) -> SqlResult<Vec<MemoryRecord>>
pub fn facts_involving(&self, entity: &str) -> SqlResult<Vec<MemoryRecord>>
Find all facts where the given entity appears as subject OR object.
pub fn stats(&self) -> SqlResult<MemoryStats>
pub fn stats_ns(&self, namespace: &str) -> SqlResult<MemoryStats>
pub fn log_audit( &self, action: &str, memory_id: Option<i64>, actor: &str, details_json: Option<&str>, ) -> SqlResult<()>
pub fn get_audit_log( &self, limit: usize, memory_id: Option<i64>, actor: Option<&str>, ) -> SqlResult<Vec<AuditEntry>>
pub fn verify_integrity(&self) -> SqlResult<VerifyResult>
pub fn verify_integrity_ns(&self, namespace: &str) -> SqlResult<VerifyResult>
Auto Trait Implementations§
impl !Freeze for MemoryStore
impl !RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl !Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl !UnwindSafe for MemoryStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more