pub struct ConversationManager<S: SessionStore> { /* private fields */ }Expand description
Session manager for handling multiple sessions
Implementations§
Source§impl<S: SessionStore> ConversationManager<S>
impl<S: SessionStore> ConversationManager<S>
pub fn new(store: Arc<S>) -> Self
pub fn with_config(self, config: SessionConfig) -> Self
Sourcepub async fn create(
&self,
session_id: impl Into<String>,
) -> Result<ConversationSession, SessionError>
pub async fn create( &self, session_id: impl Into<String>, ) -> Result<ConversationSession, SessionError>
Create a new session
Sourcepub async fn get_or_create(
&self,
session_id: impl Into<String>,
) -> Result<ConversationSession, SessionError>
pub async fn get_or_create( &self, session_id: impl Into<String>, ) -> Result<ConversationSession, SessionError>
Get or create a session
Sourcepub async fn update(
&self,
session: &ConversationSession,
) -> Result<(), SessionError>
pub async fn update( &self, session: &ConversationSession, ) -> Result<(), SessionError>
Update a session
Sourcepub async fn list(&self) -> Result<Vec<ConversationId>, SessionError>
pub async fn list(&self) -> Result<Vec<ConversationId>, SessionError>
List all sessions
Sourcepub async fn list_for_user(
&self,
user_id: &str,
) -> Result<Vec<ConversationId>, SessionError>
pub async fn list_for_user( &self, user_id: &str, ) -> Result<Vec<ConversationId>, SessionError>
List sessions for a user
Sourcepub async fn cleanup_expired(&self) -> Result<usize, SessionError>
pub async fn cleanup_expired(&self) -> Result<usize, SessionError>
Cleanup expired sessions
Auto Trait Implementations§
impl<S> Freeze for ConversationManager<S>
impl<S> RefUnwindSafe for ConversationManager<S>where
S: RefUnwindSafe,
impl<S> Send for ConversationManager<S>
impl<S> Sync for ConversationManager<S>
impl<S> Unpin for ConversationManager<S>
impl<S> UnsafeUnpin for ConversationManager<S>
impl<S> UnwindSafe for ConversationManager<S>where
S: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more