pub struct SessionManager { /* private fields */ }Expand description
Session Manager
Coordinates multi-user access to the database with per-session isolation levels and resource quotas.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn with_quota(max_sessions_per_user: usize) -> Self
pub fn with_quota(max_sessions_per_user: usize) -> Self
Create a SessionManager with custom quota limits
Sourcepub fn create_session(
&self,
user: &User,
isolation: IsolationLevel,
) -> Result<SessionId>
pub fn create_session( &self, user: &User, isolation: IsolationLevel, ) -> Result<SessionId>
Sourcepub fn destroy_session(&self, session_id: SessionId) -> Result<()>
pub fn destroy_session(&self, session_id: SessionId) -> Result<()>
Destroy a session
Sourcepub fn get_session(&self, session_id: SessionId) -> Result<Arc<RwLock<Session>>>
pub fn get_session(&self, session_id: SessionId) -> Result<Arc<RwLock<Session>>>
Get a session by ID
Sourcepub fn list_active_sessions(&self) -> Vec<SessionId>
pub fn list_active_sessions(&self) -> Vec<SessionId>
List all active sessions
Sourcepub fn delete_session(&self, session_id: SessionId) -> Result<()>
pub fn delete_session(&self, session_id: SessionId) -> Result<()>
Delete a session by ID
Sourcepub fn list_sessions(&self) -> Vec<SessionId>
pub fn list_sessions(&self) -> Vec<SessionId>
List all active session IDs
Sourcepub fn get_user_sessions(&self, user_id: &UserId) -> Vec<SessionId>
pub fn get_user_sessions(&self, user_id: &UserId) -> Vec<SessionId>
Get all sessions for a specific user
Sourcepub fn update_last_activity(&self, session_id: SessionId) -> Result<()>
pub fn update_last_activity(&self, session_id: SessionId) -> Result<()>
Update last activity timestamp for a session
Sourcepub fn cleanup_inactive_sessions(&self, timeout_secs: u64) -> usize
pub fn cleanup_inactive_sessions(&self, timeout_secs: u64) -> usize
Cleanup inactive sessions based on timeout
Returns the number of sessions cleaned up
Sourcepub fn cleanup_expired_sessions(&self) -> usize
pub fn cleanup_expired_sessions(&self) -> usize
Clean up expired sessions (uses default timeout)
Sourcepub fn enforce_quota(
&self,
user_id: &UserId,
quota: &ResourceQuota,
) -> Result<()>
pub fn enforce_quota( &self, user_id: &UserId, quota: &ResourceQuota, ) -> Result<()>
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get total number of active sessions
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