Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn create_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 ChatSession,
    ) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_session<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ChatSession>, PersistenceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn get_user_sessions<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ChatSession>, PersistenceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn update_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 ChatSession,
    ) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn delete_session<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, PersistenceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

会话存储 trait

提供聊天会话的管理

Required Methods§

Source

fn create_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 ChatSession, ) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

创建会话

Source

fn get_session<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<ChatSession>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

获取会话

Source

fn get_user_sessions<'life0, 'async_trait>( &'life0 self, user_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChatSession>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

获取用户会话列表

Source

fn update_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 ChatSession, ) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

更新会话

Source

fn delete_session<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

删除会话

Implementors§