pub struct SessionStore { /* private fields */ }Expand description
Thread-safe persistent session store backed by SQLite.
Manages active Claude Code sessions, tracking which Slack threads correspond to which agent sessions. Uses WAL mode for concurrent read access and per-row updates.
§Thread Safety
All methods are async and use spawn_blocking with a sync Mutex
to avoid holding locks across await points.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub async fn insert(&self, session: SessionInfo) -> Result<()>
pub async fn insert(&self, session: SessionInfo) -> Result<()>
Inserts a new session into the database.
Sourcepub async fn get_by_thread(&self, thread_ts: &str) -> Option<SessionInfo>
pub async fn get_by_thread(&self, thread_ts: &str) -> Option<SessionInfo>
Retrieves a session by its Slack thread timestamp.
pub async fn active_sessions(&self) -> Vec<SessionInfo>
Sourcepub async fn has_session_id(&self, session_id: &str) -> bool
pub async fn has_session_id(&self, session_id: &str) -> bool
Checks if any session has the given agent session ID (indexed lookup).
Sourcepub async fn prune_stale_channels(
&self,
repo_channels: &HashMap<String, String>,
)
pub async fn prune_stale_channels( &self, repo_channels: &HashMap<String, String>, )
Remove sessions whose channel_id doesn’t match the current channel for their repo.
Sourcepub async fn prune_expired(&self, ttl_days: i64)
pub async fn prune_expired(&self, ttl_days: i64)
Remove sessions whose last_active is older than the TTL.
Trait Implementations§
Source§impl Clone for SessionStore
impl Clone for SessionStore
Source§fn clone(&self) -> SessionStore
fn clone(&self) -> SessionStore
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 SessionStore
impl RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
impl UnwindSafe for SessionStore
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