pub struct SessionManager { /* private fields */ }Expand description
Session manager.
Manages all active sessions and their lifecycle.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn with_config(config: SessionManagerConfig) -> Self
pub fn with_config(config: SessionManagerConfig) -> Self
Create a new session manager with config.
Sourcepub fn create_session(
&self,
session_name: impl Into<String>,
) -> Result<SessionInfo, SessionError>
pub fn create_session( &self, session_name: impl Into<String>, ) -> Result<SessionInfo, SessionError>
Create a new session.
Sourcepub fn activate_session(
&self,
session_id: &NodeId,
user_identity: UserIdentity,
) -> Result<(), SessionError>
pub fn activate_session( &self, session_id: &NodeId, user_identity: UserIdentity, ) -> Result<(), SessionError>
Activate a session.
Sourcepub fn close_session(&self, session_id: &NodeId) -> Result<(), SessionError>
pub fn close_session(&self, session_id: &NodeId) -> Result<(), SessionError>
Close a session.
Sourcepub fn get_session(&self, session_id: &NodeId) -> Option<SessionInfo>
pub fn get_session(&self, session_id: &NodeId) -> Option<SessionInfo>
Get a session.
Sourcepub fn get_session_by_token(&self, auth_token: &NodeId) -> Option<SessionInfo>
pub fn get_session_by_token(&self, auth_token: &NodeId) -> Option<SessionInfo>
Get session by authentication token.
Sourcepub fn touch_session(&self, session_id: &NodeId)
pub fn touch_session(&self, session_id: &NodeId)
Update session activity.
Sourcepub fn add_subscription(
&self,
session_id: &NodeId,
subscription_id: u32,
) -> Result<(), SessionError>
pub fn add_subscription( &self, session_id: &NodeId, subscription_id: u32, ) -> Result<(), SessionError>
Add subscription to session.
Sourcepub fn remove_subscription(&self, session_id: &NodeId, subscription_id: u32)
pub fn remove_subscription(&self, session_id: &NodeId, subscription_id: u32)
Remove subscription from session.
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Cleanup expired sessions.
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get the number of active sessions.
Sourcepub fn session_ids(&self) -> Vec<NodeId>
pub fn session_ids(&self) -> Vec<NodeId>
Get all session IDs.
Sourcepub fn subscribe_events(&self) -> Receiver<SessionEvent>
pub fn subscribe_events(&self) -> Receiver<SessionEvent>
Subscribe to session events.
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 UnsafeUnpin 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
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