Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Send + Sync {
    // Required methods
    fn save_session(
        &self,
        id: Uuid,
        metadata: &SessionMetadata,
        conversation: &ConversationSnapshot,
        state: &SessionState,
    ) -> impl Future<Output = Result<()>> + Send;
    fn load_session(
        &self,
        id: Uuid,
    ) -> impl Future<Output = Result<(SessionMetadata, ConversationSnapshot, SessionState)>> + Send;
    fn delete_session(
        &self,
        id: Uuid,
    ) -> impl Future<Output = Result<()>> + Send;
    fn list_sessions(
        &self,
    ) -> impl Future<Output = Result<Vec<SessionMetadata>>> + Send;
    fn load_index(&self) -> impl Future<Output = Result<SessionIndex>> + Send;
    fn save_index(
        &self,
        index: &SessionIndex,
    ) -> impl Future<Output = Result<()>> + Send;
}
Expand description

Storage backend trait for different storage implementations

Required Methods§

Source

fn save_session( &self, id: Uuid, metadata: &SessionMetadata, conversation: &ConversationSnapshot, state: &SessionState, ) -> impl Future<Output = Result<()>> + Send

Save session to storage

Source

fn load_session( &self, id: Uuid, ) -> impl Future<Output = Result<(SessionMetadata, ConversationSnapshot, SessionState)>> + Send

Load session from storage

Source

fn delete_session(&self, id: Uuid) -> impl Future<Output = Result<()>> + Send

Delete session from storage

Source

fn list_sessions( &self, ) -> impl Future<Output = Result<Vec<SessionMetadata>>> + Send

List all sessions

Source

fn load_index(&self) -> impl Future<Output = Result<SessionIndex>> + Send

Load session index

Source

fn save_index( &self, index: &SessionIndex, ) -> impl Future<Output = Result<()>> + Send

Save session index

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§