pub struct SqliteSessionManager { /* private fields */ }Expand description
SQLite-backed session manager
Persists session IDs to SQLite so clients can reconnect after server restart. The actual session workers are created on-demand, but session identity persists.
Implementations§
Source§impl SqliteSessionManager
impl SqliteSessionManager
Sourcepub async fn new(
config: SqliteSessionConfig,
) -> Result<Self, SqliteSessionError>
pub async fn new( config: SqliteSessionConfig, ) -> Result<Self, SqliteSessionError>
Create a new SQLite session manager
Sourcepub async fn cleanup_old_sessions(&self) -> Result<usize, SqliteSessionError>
pub async fn cleanup_old_sessions(&self) -> Result<usize, SqliteSessionError>
Clean up sessions older than max_session_age
Returns the number of sessions cleaned up
Trait Implementations§
Source§impl SessionManager for SqliteSessionManager
impl SessionManager for SqliteSessionManager
type Error = SqliteSessionError
type Transport = WorkerTransport<LocalSessionWorker>
Source§async fn create_session(
&self,
) -> Result<(SessionId, Self::Transport), Self::Error>
async fn create_session( &self, ) -> Result<(SessionId, Self::Transport), Self::Error>
Create a new session with the given id and configuration.
async fn initialize_session( &self, id: &SessionId, message: ClientJsonRpcMessage, ) -> Result<ServerJsonRpcMessage, Self::Error>
async fn has_session(&self, id: &SessionId) -> Result<bool, Self::Error>
async fn close_session(&self, id: &SessionId) -> Result<(), Self::Error>
async fn create_stream( &self, id: &SessionId, message: ClientJsonRpcMessage, ) -> Result<impl Stream<Item = ServerSseMessage> + Send + 'static, Self::Error>
async fn create_standalone_stream( &self, id: &SessionId, ) -> Result<impl Stream<Item = ServerSseMessage> + Send + 'static, Self::Error>
async fn resume( &self, id: &SessionId, last_event_id: String, ) -> Result<impl Stream<Item = ServerSseMessage> + Send + 'static, Self::Error>
async fn accept_message( &self, id: &SessionId, message: ClientJsonRpcMessage, ) -> Result<(), Self::Error>
Auto Trait Implementations§
impl !Freeze for SqliteSessionManager
impl !RefUnwindSafe for SqliteSessionManager
impl Send for SqliteSessionManager
impl Sync for SqliteSessionManager
impl Unpin for SqliteSessionManager
impl !UnwindSafe for SqliteSessionManager
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