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§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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)
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn compact<'life0, 'async_trait>(
&'life0 self,
) -> 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,
Force database compaction
Provided Methods§
Sourcefn 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,
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.