Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore<K: Send + Sync, V: Send>: StateStore {
    // Required methods
    fn find_sessions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 K,
        earliest_end: i64,
        latest_start: i64,
    ) -> Pin<Box<dyn Future<Output = Vec<(i64, i64, V)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 mut self,
        key: K,
        start: i64,
        end: i64,
        value: V,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        key: &'life1 K,
        start: i64,
        end: i64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_closed_sessions<'life0, 'async_trait>(
        &'life0 self,
        close_time: i64,
    ) -> Pin<Box<dyn Future<Output = Vec<(K, i64, i64, V)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Typed session store keyed by (K, start, end).

find_sessions returns the merge candidates for a record. Those are the sessions whose [start, end] overlaps the inactivity gap window [earliest_end, latest_start].

Required Methods§

Source

fn find_sessions<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, earliest_end: i64, latest_start: i64, ) -> Pin<Box<dyn Future<Output = Vec<(i64, i64, V)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the sessions for key with end >= earliest_end && start <= latest_start.

The result is (start, end, value) in store order. Store order is end ascending, then start ascending.

Source

fn put<'life0, 'async_trait>( &'life0 mut self, key: K, start: i64, end: i64, value: V, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 mut self, key: &'life1 K, start: i64, end: i64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn find_closed_sessions<'life0, 'async_trait>( &'life0 self, close_time: i64, ) -> Pin<Box<dyn Future<Output = Vec<(K, i64, i64, V)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns every session across ALL keys whose end <= close_time.

The result is (key, start, end, value). The emit-final closed-session scan uses this method.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<K: Send + Sync + 'static, V: Send + 'static> SessionStore<K, V> for SessionBytesStore<K, V>