SessionManager

Struct SessionManager 

Source
pub struct SessionManager { /* private fields */ }
Expand description

Comprehensive session manager for MCP applications

Implementations§

Source§

impl SessionManager

Source

pub fn new(config: SessionConfig) -> Self

Create a new session manager

Source

pub fn start(&self)

Start the session manager (begin cleanup task)

Source

pub fn get_or_create_session( &self, client_id: String, transport_type: String, ) -> ClientSession

Create or get existing session for a client

Source

pub fn update_client_activity(&self, client_id: &str)

Update client activity

Source

pub fn authenticate_client( &self, client_id: &str, client_name: Option<String>, token: Option<String>, ) -> bool

Authenticate a client session

Source

pub fn record_request(&self, request_info: RequestInfo)

Record a request for analytics

Source

pub fn get_analytics(&self) -> SessionAnalytics

Get session analytics

Source

pub fn get_active_sessions(&self) -> Vec<ClientSession>

Get all active sessions

Source

pub fn get_session(&self, client_id: &str) -> Option<ClientSession>

Get session by client ID

Source

pub fn client_extractor(&self) -> Arc<ClientIdExtractor>

Get client ID extractor

Source

pub fn terminate_session(&self, client_id: &str) -> bool

Terminate a session

Source

pub fn get_request_history(&self, limit: Option<usize>) -> Vec<RequestInfo>

Get request history

Source

pub fn get_session_events(&self, limit: Option<usize>) -> Vec<SessionEvent>

Get session events

Trait Implementations§

Source§

impl Debug for SessionManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SessionManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V