pub struct SessionTracker { /* private fields */ }Expand description
Session tracker for managing active sessions
Implementations§
Source§impl SessionTracker
impl SessionTracker
Sourcepub fn new(config: SessionConfig) -> Self
pub fn new(config: SessionConfig) -> Self
Create a new session tracker
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Create with default config
Sourcepub fn create_session(&self) -> Option<Session>
pub fn create_session(&self) -> Option<Session>
Create a new session
Sourcepub fn create_session_with_id(&self, id: SessionId) -> Option<Session>
pub fn create_session_with_id(&self, id: SessionId) -> Option<Session>
Create a session with a specific ID
Sourcepub fn set_state(&self, id: &SessionId, state: SessionState) -> bool
pub fn set_state(&self, id: &SessionId, state: SessionState) -> bool
Update session state
Sourcepub fn end_session(&self, id: &SessionId) -> Option<Session>
pub fn end_session(&self, id: &SessionId) -> Option<Session>
End a session
Sourcepub fn active_sessions(&self) -> Vec<Session>
pub fn active_sessions(&self) -> Vec<Session>
Get all active sessions
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get active session count
Sourcepub fn check_idle(&self) -> Vec<SessionId>
pub fn check_idle(&self) -> Vec<SessionId>
Check for idle sessions and update their state
Sourcepub fn prepare_migration(&self) -> Vec<Session>
pub fn prepare_migration(&self) -> Vec<Session>
Prepare all sessions for migration (e.g., before server shutdown)
Sourcepub fn export_sessions(&self) -> Vec<Session>
pub fn export_sessions(&self) -> Vec<Session>
Export all sessions for migration
Sourcepub fn import_sessions(&self, sessions: Vec<Session>) -> usize
pub fn import_sessions(&self, sessions: Vec<Session>) -> usize
Import sessions (e.g., after migration)
Trait Implementations§
Source§impl Clone for SessionTracker
impl Clone for SessionTracker
Source§fn clone(&self) -> SessionTracker
fn clone(&self) -> SessionTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionTracker
impl !RefUnwindSafe for SessionTracker
impl Send for SessionTracker
impl Sync for SessionTracker
impl Unpin for SessionTracker
impl !UnwindSafe for SessionTracker
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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