Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        id: &'life1 SessionId,
        sealed: &'life2 [u8],
        ttl: Duration,
        meta: &'life3 SessionMeta,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_subject<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subject: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filter: &'life1 SessionFilter,
    ) -> Pin<Box<dyn Future<Output = Result<SessionPage, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn try_lock<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 SessionId,
        ttl: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unlock<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A backend holding sealed session payloads plus their meta envelopes.

Required Methods§

Source

fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 SessionId, sealed: &'life2 [u8], ttl: Duration, meta: &'life3 SessionMeta, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Upserts a session: sealed payload + meta, both expiring after ttl.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 SessionId, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The sealed payload, or None if absent/expired.

Source

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

Revokes one session (payload + meta + subject-index entry).

Source

fn delete_subject<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revokes every session for subject; returns how many were removed.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 SessionFilter, ) -> Pin<Box<dyn Future<Output = Result<SessionPage, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

One page of metadata matching filter.

Source

fn try_lock<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 SessionId, ttl: Duration, ) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Best-effort short lock for refresh coordination: true = acquired.

Source

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§