Skip to main content

SessionStorageStore

Trait SessionStorageStore 

Source
pub trait SessionStorageStore: Send + Sync {
    // Required methods
    fn set_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        key: &'life1 str,
        value: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_value<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_value<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_keys<'life0, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_secret<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        name: &'life1 str,
        value: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_secret<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_secret<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_secrets<'life0, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SecretInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for session key/value and secret storage operations

This trait abstracts storage operations for tools that need to persist data within a session. Implementations can:

  • Store data in a database (production)
  • Use in-memory storage for testing

Key/value storage is for general data that doesn’t need encryption. Secret storage is for sensitive data that is encrypted at rest.

Required Methods§

Source

fn set_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: SessionId, key: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set a key/value pair (creates or updates)

Source

fn get_value<'life0, 'life1, 'async_trait>( &'life0 self, session_id: SessionId, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a value by key

Source

fn delete_value<'life0, 'life1, 'async_trait>( &'life0 self, session_id: SessionId, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a key/value pair

Source

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

List all keys in a session

Source

fn set_secret<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: SessionId, name: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set a secret (creates or updates, value is encrypted before storage)

Source

fn get_secret<'life0, 'life1, 'async_trait>( &'life0 self, session_id: SessionId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a secret by name (value is decrypted before returning)

Source

fn delete_secret<'life0, 'life1, 'async_trait>( &'life0 self, session_id: SessionId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a secret

Source

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

List all secret names in a session (without values)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§