Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn get_session(
        &self,
        session_id: &str,
    ) -> impl Future<Output = Option<SessionRecord>> + Send;
    fn create_session(
        &self,
        record: SessionRecord,
    ) -> impl Future<Output = SessionRecord> + Send;
    fn update_last_used(
        &self,
        session_id: &str,
    ) -> impl Future<Output = ()> + Send;
    fn increment_reset_count(
        &self,
        session_id: &str,
    ) -> impl Future<Output = ()> + Send;
    fn get_loop_id_for_session(
        &self,
        session_id: &str,
    ) -> impl Future<Output = Option<String>> + Send;
    fn set_loop_id(
        &self,
        session_id: &str,
        loop_id: &str,
    ) -> impl Future<Output = ()> + Send;
    fn append_message(
        &self,
        session_id: &str,
        message: Value,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

Session ↔ loop persistence.

Required Methods§

Source

fn get_session( &self, session_id: &str, ) -> impl Future<Output = Option<SessionRecord>> + Send

Load session.

Source

fn create_session( &self, record: SessionRecord, ) -> impl Future<Output = SessionRecord> + Send

Create session.

Source

fn update_last_used(&self, session_id: &str) -> impl Future<Output = ()> + Send

Touch last-used (no-op ok).

Source

fn increment_reset_count( &self, session_id: &str, ) -> impl Future<Output = ()> + Send

Increment reset count.

Source

fn get_loop_id_for_session( &self, session_id: &str, ) -> impl Future<Output = Option<String>> + Send

Lookup loop id.

Source

fn set_loop_id( &self, session_id: &str, loop_id: &str, ) -> impl Future<Output = ()> + Send

Bind loop id.

Source

fn append_message( &self, session_id: &str, message: Value, ) -> impl Future<Output = ()> + Send

Append a message.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§