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

Source

pub fn add_pending_elicitation( &self, client_id: String, elicitation: ElicitationContext, )

Add a pending elicitation for a client

Source

pub fn get_pending_elicitations( &self, client_id: &str, ) -> Vec<ElicitationContext>

Get all pending elicitations for a client

Source

pub fn update_elicitation_state( &self, client_id: &str, elicitation_id: &str, state: ElicitationState, ) -> bool

Update an elicitation state

Source

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

Remove completed elicitations for a client

Source

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

Clear all elicitations for a client

Source

pub fn add_active_completion( &self, client_id: String, completion: CompletionContext, )

Add an active completion for a client

Source

pub fn get_active_completions(&self, client_id: &str) -> Vec<CompletionContext>

Get all active completions for a client

Source

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

Remove a specific completion

Source

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

Clear all completions for a client

Source

pub fn get_enhanced_analytics(&self) -> SessionAnalytics

Get session statistics including elicitations and completions

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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