pub struct AsyncSessionStore { /* private fields */ }Expand description
Async facade around a SessionRepository implementation.
Implementations§
Source§impl AsyncSessionStore
impl AsyncSessionStore
Sourcepub fn new(async_db: Arc<AsyncDatabase>) -> Self
pub fn new(async_db: Arc<AsyncDatabase>) -> Self
Creates a SQLite-backed async session store.
Sourcepub fn with_repository(repository: Arc<dyn SessionRepository>) -> Self
pub fn with_repository(repository: Arc<dyn SessionRepository>) -> Self
Creates an async session store from a repository implementation.
Sourcepub async fn insert_session(&self, s: OwnedNewSession) -> Result<()>
pub async fn insert_session(&self, s: OwnedNewSession) -> Result<()>
Inserts a new session row.
Sourcepub async fn update_session_state(
&self,
session_id: &str,
state: &str,
exit_code: Option<i64>,
ended: bool,
) -> Result<()>
pub async fn update_session_state( &self, session_id: &str, state: &str, exit_code: Option<i64>, ended: bool, ) -> Result<()>
Updates session state, exit code, and optional end time.
Sourcepub async fn update_session_pid(&self, session_id: &str, pid: i64) -> Result<()>
pub async fn update_session_pid(&self, session_id: &str, pid: i64) -> Result<()>
Updates the PID associated with a session.
Sourcepub async fn load_session(&self, session_id: &str) -> Result<Option<SessionRow>>
pub async fn load_session(&self, session_id: &str) -> Result<Option<SessionRow>>
Loads a session row by identifier.
Sourcepub async fn load_active_session_for_task_step(
&self,
task_id: &str,
step_id: &str,
) -> Result<Option<SessionRow>>
pub async fn load_active_session_for_task_step( &self, task_id: &str, step_id: &str, ) -> Result<Option<SessionRow>>
Loads the latest active or detached session for a task step.
Sourcepub async fn list_task_sessions(&self, task_id: &str) -> Result<Vec<SessionRow>>
pub async fn list_task_sessions(&self, task_id: &str) -> Result<Vec<SessionRow>>
Lists all sessions for a task.
Sourcepub async fn acquire_writer(
&self,
session_id: &str,
client_id: &str,
) -> Result<bool>
pub async fn acquire_writer( &self, session_id: &str, client_id: &str, ) -> Result<bool>
Attempts to acquire the writer lease for a session.
Sourcepub async fn attach_reader(
&self,
session_id: &str,
client_id: &str,
) -> Result<()>
pub async fn attach_reader( &self, session_id: &str, client_id: &str, ) -> Result<()>
Attaches a read-only client to a session.
Sourcepub async fn cleanup_stale_sessions(&self, max_age_hours: u64) -> Result<usize>
pub async fn cleanup_stale_sessions(&self, max_age_hours: u64) -> Result<usize>
Deletes stale terminal sessions and returns the number removed.
Auto Trait Implementations§
impl Freeze for AsyncSessionStore
impl !RefUnwindSafe for AsyncSessionStore
impl Send for AsyncSessionStore
impl Sync for AsyncSessionStore
impl Unpin for AsyncSessionStore
impl UnsafeUnpin for AsyncSessionStore
impl !UnwindSafe for AsyncSessionStore
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request