pub struct SessionManager { /* private fields */ }
Expand description
Session manager for handling multiple conversation sessions
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(config: SessionConfig) -> Self
pub fn new(config: SessionConfig) -> Self
Create a new session manager
Sourcepub fn create_session(
&mut self,
metadata: SessionMetadata,
context_strategy: Option<ContextStrategy>,
) -> String
pub fn create_session( &mut self, metadata: SessionMetadata, context_strategy: Option<ContextStrategy>, ) -> String
Create a new session
Sourcepub fn get_session(&self, session_id: &str) -> Option<&ConversationSession>
pub fn get_session(&self, session_id: &str) -> Option<&ConversationSession>
Get a session by ID
Sourcepub fn get_session_mut(
&mut self,
session_id: &str,
) -> Option<&mut ConversationSession>
pub fn get_session_mut( &mut self, session_id: &str, ) -> Option<&mut ConversationSession>
Get a mutable session by ID
Sourcepub fn add_message(
&mut self,
session_id: &str,
message: LLMMessage,
) -> LLMResult<()>
pub fn add_message( &mut self, session_id: &str, message: LLMMessage, ) -> LLMResult<()>
Add a message to a session
Sourcepub fn get_active_messages(
&self,
session_id: &str,
) -> LLMResult<Vec<LLMMessage>>
pub fn get_active_messages( &self, session_id: &str, ) -> LLMResult<Vec<LLMMessage>>
Get active messages for a session
Sourcepub fn list_sessions(&self) -> Vec<String>
pub fn list_sessions(&self) -> Vec<String>
List all session IDs
Sourcepub fn get_user_sessions(&self, user_id: &str) -> Vec<String>
pub fn get_user_sessions(&self, user_id: &str) -> Vec<String>
Get sessions by user ID
Sourcepub fn cleanup_expired(&mut self) -> usize
pub fn cleanup_expired(&mut self) -> usize
Clean up expired sessions
Sourcepub fn pause_session(&mut self, session_id: &str) -> LLMResult<()>
pub fn pause_session(&mut self, session_id: &str) -> LLMResult<()>
Pause a session
Sourcepub fn resume_session(&mut self, session_id: &str) -> LLMResult<()>
pub fn resume_session(&mut self, session_id: &str) -> LLMResult<()>
Resume a session
Sourcepub fn close_session(&mut self, session_id: &str) -> LLMResult<()>
pub fn close_session(&mut self, session_id: &str) -> LLMResult<()>
Close a session
Sourcepub fn remove_session(
&mut self,
session_id: &str,
) -> Option<ConversationSession>
pub fn remove_session( &mut self, session_id: &str, ) -> Option<ConversationSession>
Remove a session completely
Sourcepub fn get_stats(&self) -> SessionStats
pub fn get_stats(&self) -> SessionStats
Get session statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnwindSafe for SessionManager
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