pub struct SessionDataManager {
pub session_manager: Arc<SessionManager>,
/* private fields */
}Expand description
Session-scoped data manager
Manages per-session virtual databases when session-scoped data is enabled. Each session gets its own isolated database instance.
Fields§
§session_manager: Arc<SessionManager>Session manager from mockforge-core
Implementations§
Source§impl SessionDataManager
impl SessionDataManager
Sourcepub fn new(
session_manager: Arc<SessionManager>,
storage_backend: StorageBackend,
) -> Self
pub fn new( session_manager: Arc<SessionManager>, storage_backend: StorageBackend, ) -> Self
Create a new session data manager
Sourcepub async fn get_session_database(
&self,
session_id: &str,
) -> Result<Arc<dyn VirtualDatabase + Send + Sync>>
pub async fn get_session_database( &self, session_id: &str, ) -> Result<Arc<dyn VirtualDatabase + Send + Sync>>
Get or create session-scoped database instance
If session-scoped data is enabled, each session gets its own isolated database. This allows different users/sessions to have separate data.
Sourcepub async fn cleanup_session_database(&self, session_id: &str) -> Result<()>
pub async fn cleanup_session_database(&self, session_id: &str) -> Result<()>
Clean up database for a session
Sourcepub async fn cleanup_expired_sessions(&self) -> Result<usize>
pub async fn cleanup_expired_sessions(&self) -> Result<usize>
Clean up databases for expired sessions
Sourcepub fn session_manager(&self) -> &Arc<SessionManager>
pub fn session_manager(&self) -> &Arc<SessionManager>
Get the session manager
Sourcepub async fn get_session_state(&self, session_id: &str) -> Option<SessionState>
pub async fn get_session_state(&self, session_id: &str) -> Option<SessionState>
Get session state (returns session if it exists)
Sourcepub async fn update_session_state(
&self,
session_id: &str,
state: SessionState,
) -> Result<()>
pub async fn update_session_state( &self, session_id: &str, state: SessionState, ) -> Result<()>
Update session state
Auto Trait Implementations§
impl Freeze for SessionDataManager
impl !RefUnwindSafe for SessionDataManager
impl Send for SessionDataManager
impl Sync for SessionDataManager
impl Unpin for SessionDataManager
impl !UnwindSafe for SessionDataManager
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