Skip to main content

Storage

Trait Storage 

Source
pub trait Storage:
    FreshnessStorage
    + Send
    + Sync {
Show 20 methods // Required methods fn save_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 ActiveSession, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_session<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<ActiveSession>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_session<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn clear_session_entities<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_sessions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn session_exists<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn batch_save_updates<'life0, 'async_trait>( &'life0 self, session_id: Uuid, updates: Vec<ContextUpdate>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_session_updates<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ContextUpdate>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_checkpoint<'life0, 'life1, 'async_trait>( &'life0 self, checkpoint: &'life1 SessionCheckpoint, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_checkpoint<'life0, 'async_trait>( &'life0 self, checkpoint_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<SessionCheckpoint>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_checkpoints<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionCheckpoint>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_workspace_metadata<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, workspace_id: Uuid, name: &'life1 str, description: &'life2 str, session_ids: &'life3 [Uuid], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn delete_workspace<'life0, 'async_trait>( &'life0 self, workspace_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_workspaces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<StoredWorkspace>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_session_to_workspace<'life0, 'async_trait>( &'life0 self, workspace_id: Uuid, session_id: Uuid, role: SessionRole, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn remove_session_from_workspace<'life0, 'async_trait>( &'life0 self, workspace_id: Uuid, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn compact<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_key_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn save_session_with_updates<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 ActiveSession, session_id: Uuid, updates: Vec<ContextUpdate>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

This trait defines the fundamental storage operations required for session management, context updates, and workspace persistence.

Implementations must be Send + Sync for concurrent access.

Required Methods§

Source

fn save_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 ActiveSession, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save a session to storage

Source

fn load_session<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<ActiveSession>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load a session from storage

Source

fn delete_session<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a session and all related data

Source

fn clear_session_entities<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete all entities and relationships for a session (used by entity graph rebuild)

Source

fn list_sessions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all session IDs

Source

fn session_exists<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if a session exists

Source

fn batch_save_updates<'life0, 'async_trait>( &'life0 self, session_id: Uuid, updates: Vec<ContextUpdate>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Batch save multiple context updates efficiently

Source

fn load_session_updates<'life0, 'async_trait>( &'life0 self, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ContextUpdate>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all updates for a session

Source

fn save_checkpoint<'life0, 'life1, 'async_trait>( &'life0 self, checkpoint: &'life1 SessionCheckpoint, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save a session checkpoint

Source

fn load_checkpoint<'life0, 'async_trait>( &'life0 self, checkpoint_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<SessionCheckpoint>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load a session checkpoint

Source

fn list_checkpoints<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionCheckpoint>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all checkpoints

Source

fn save_workspace_metadata<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, workspace_id: Uuid, name: &'life1 str, description: &'life2 str, session_ids: &'life3 [Uuid], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Save workspace metadata

Source

fn delete_workspace<'life0, 'async_trait>( &'life0 self, workspace_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a workspace

Source

fn list_workspaces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<StoredWorkspace>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all workspaces

Source

fn add_session_to_workspace<'life0, 'async_trait>( &'life0 self, workspace_id: Uuid, session_id: Uuid, role: SessionRole, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a session to a workspace

Source

fn remove_session_from_workspace<'life0, 'async_trait>( &'life0 self, workspace_id: Uuid, session_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a session from a workspace

Source

fn compact<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Force database compaction

Source

fn get_key_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get estimated number of keys in database

Source

fn get_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get database statistics as a string

Provided Methods§

Source

fn save_session_with_updates<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 ActiveSession, session_id: Uuid, updates: Vec<ContextUpdate>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save session and context updates in a single atomic write. Default implementation calls save_session then batch_save_updates sequentially. Backends can override for a single WriteBatch operation.

Implementors§