pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub fn log_consolidation( &self, id: &str, action: &str, memory_ids: &[String], reason: Option<&str>, performed_by: &str, timestamp: &str, ) -> Result<(), StorageError>
pub fn track_search( &self, memory_id: &str, timestamp: &str, ) -> Result<(), StorageError>
pub fn mark_judged( &self, memory_id: &str, timestamp: &str, ) -> Result<(), StorageError>
pub fn get_pending_judgments( &self, limit: usize, ) -> Result<Vec<String>, StorageError>
Source§impl Database
impl Database
Sourcepub fn open(path: &str) -> Result<Self, StorageError>
pub fn open(path: &str) -> Result<Self, StorageError>
Open or create database at the given path.
Sourcepub fn open_read_only(path: &str) -> Result<Self, StorageError>
pub fn open_read_only(path: &str) -> Result<Self, StorageError>
Open an existing database in read-only mode.
Skips schema application: the caller must ensure the schema already exists
(a read-only connection cannot run CREATE TABLE or set PRAGMA journal_mode).
Intended for defense-in-depth scenarios where the source database must not
be mutated (e.g. engram migrate).
Sourcepub fn in_memory() -> Result<Self, StorageError>
pub fn in_memory() -> Result<Self, StorageError>
Create an in-memory database (for testing).
pub fn connection(&self) -> &Connection
Source§impl Database
impl Database
pub fn search_fts( &self, query: &str, limit: usize, ) -> Result<Vec<FtsResult>, StorageError>
Source§impl Database
impl Database
pub fn insert_memory(&self, memory: &Memory) -> Result<(), StorageError>
pub fn get_memory(&self, id: &str) -> Result<Memory, StorageError>
pub fn set_memory_indexed( &self, id: &str, indexed: bool, ) -> Result<(), StorageError>
pub fn set_memory_embeddings( &self, id: &str, embedding_context: &[u8], embedding_action: &[u8], embedding_result: &[u8], ) -> Result<(), StorageError>
pub fn set_memory_score(&self, id: &str, score: f32) -> Result<(), StorageError>
pub fn touch_memory( &self, id: &str, timestamp: &str, ) -> Result<(), StorageError>
pub fn set_superseded_by( &self, id: &str, superseded_by: &str, ) -> Result<(), StorageError>
pub fn delete_memory(&self, id: &str) -> Result<(), StorageError>
pub fn bulk_insert_memories( &self, memories: &[Memory], ) -> Result<usize, StorageError>
pub fn list_all_memories(&self) -> Result<Vec<Memory>, StorageError>
pub fn get_unindexed_memories( &self, limit: usize, ) -> Result<Vec<Memory>, StorageError>
pub fn get_indexed_memory_ids(&self) -> Result<Vec<String>, StorageError>
Source§impl Database
impl Database
pub fn upsert_q_value( &self, level: &str, state: &str, action: &str, value: f32, timestamp: &str, ) -> Result<(), StorageError>
pub fn get_q_value( &self, level: &str, state: &str, action: &str, ) -> Result<f32, StorageError>
pub fn load_q_table( &self, level: &str, ) -> Result<Vec<(String, String, f32, u32)>, StorageError>
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl !Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
impl !UnwindSafe for Database
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