pub struct SessionManager { /* private fields */ }
Expand description
Comprehensive session manager for MCP applications
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 get_or_create_session(
&self,
client_id: String,
transport_type: String,
) -> ClientSession
pub fn get_or_create_session( &self, client_id: String, transport_type: String, ) -> ClientSession
Create or get existing session for a client
Sourcepub fn update_client_activity(&self, client_id: &str)
pub fn update_client_activity(&self, client_id: &str)
Update client activity
Sourcepub fn authenticate_client(
&self,
client_id: &str,
client_name: Option<String>,
token: Option<String>,
) -> bool
pub fn authenticate_client( &self, client_id: &str, client_name: Option<String>, token: Option<String>, ) -> bool
Authenticate a client session
Sourcepub fn record_request(&self, request_info: RequestInfo)
pub fn record_request(&self, request_info: RequestInfo)
Record a request for analytics
Sourcepub fn get_analytics(&self) -> SessionAnalytics
pub fn get_analytics(&self) -> SessionAnalytics
Get session analytics
Sourcepub fn get_active_sessions(&self) -> Vec<ClientSession>
pub fn get_active_sessions(&self) -> Vec<ClientSession>
Get all active sessions
Sourcepub fn get_session(&self, client_id: &str) -> Option<ClientSession>
pub fn get_session(&self, client_id: &str) -> Option<ClientSession>
Get session by client ID
Sourcepub fn client_extractor(&self) -> Arc<ClientIdExtractor>
pub fn client_extractor(&self) -> Arc<ClientIdExtractor>
Get client ID extractor
Sourcepub fn terminate_session(&self, client_id: &str) -> bool
pub fn terminate_session(&self, client_id: &str) -> bool
Terminate a session
Sourcepub fn get_request_history(&self, limit: Option<usize>) -> Vec<RequestInfo>
pub fn get_request_history(&self, limit: Option<usize>) -> Vec<RequestInfo>
Get request history
Sourcepub fn get_session_events(&self, limit: Option<usize>) -> Vec<SessionEvent>
pub fn get_session_events(&self, limit: Option<usize>) -> Vec<SessionEvent>
Get session events
Trait Implementations§
Source§impl Debug for SessionManager
impl Debug for SessionManager
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