Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn has_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        fingerprint: &'life1 IdentityFingerprint,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cache_session<'life0, 'async_trait>(
        &'life0 mut self,
        fingerprint: IdentityFingerprint,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_session<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        fingerprint: &'life1 IdentityFingerprint,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn clear<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_sessions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<(IdentityFingerprint, Option<String>, u64, u64)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_session_name<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        fingerprint: &'life1 IdentityFingerprint,
        name: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_last_connected<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        fingerprint: &'life1 IdentityFingerprint,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_transport_state<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        fingerprint: &'life1 IdentityFingerprint,
        transport_state: MultiDeviceTransport,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_transport_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        fingerprint: &'life1 IdentityFingerprint,
    ) -> Pin<Box<dyn Future<Output = Result<Option<MultiDeviceTransport>, ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for session cache storage implementations

Provides an abstraction for storing and retrieving approved remote fingerprints. Implementations must be thread-safe for use in async contexts.

Required Methods§

Source

fn has_session<'life0, 'life1, 'async_trait>( &'life0 self, fingerprint: &'life1 IdentityFingerprint, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a fingerprint exists in the cache

Source

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

Cache a new session fingerprint

If the fingerprint already exists, updates the cached_at timestamp.

Source

fn remove_session<'life0, 'life1, 'async_trait>( &'life0 mut self, fingerprint: &'life1 IdentityFingerprint, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a fingerprint from the cache

Source

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

Clear all cached sessions

Source

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

List all cached sessions

Returns tuples of (fingerprint, optional_name, created_timestamp, last_connected_timestamp)

Source

fn set_session_name<'life0, 'life1, 'async_trait>( &'life0 mut self, fingerprint: &'life1 IdentityFingerprint, name: String, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set a friendly name for a cached session

Source

fn update_last_connected<'life0, 'life1, 'async_trait>( &'life0 mut self, fingerprint: &'life1 IdentityFingerprint, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update the last_connected_at timestamp for a session

Source

fn save_transport_state<'life0, 'life1, 'async_trait>( &'life0 mut self, fingerprint: &'life1 IdentityFingerprint, transport_state: MultiDeviceTransport, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save transport state for a session

This allows session resumption without requiring a new Noise handshake.

Source

fn load_transport_state<'life0, 'life1, 'async_trait>( &'life0 self, fingerprint: &'life1 IdentityFingerprint, ) -> Pin<Box<dyn Future<Output = Result<Option<MultiDeviceTransport>, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load transport state for a session

Returns None if no transport state is stored for this session.

Implementors§