pub enum AnySessionStore {
InMemory(SessionStore),
StorageBacked(StorageBackedSessionStore),
}Expand description
A session store that dispatches to either in-memory or storage-backed.
Variants§
InMemory(SessionStore)
StorageBacked(StorageBackedSessionStore)
Implementations§
Source§impl AnySessionStore
impl AnySessionStore
Sourcepub async fn create(&self, req: CreateSessionRequest) -> TaskSession
pub async fn create(&self, req: CreateSessionRequest) -> TaskSession
Create a new task session and return it.
Sourcepub async fn use_session(
&self,
session_id: SessionId,
tool_name: &str,
) -> Result<TaskSession, SessionError>
pub async fn use_session( &self, session_id: SessionId, tool_name: &str, ) -> Result<TaskSession, SessionError>
Record a tool call against the session.
Sourcepub async fn use_session_batch(
&self,
session_id: SessionId,
tool_names: &[&str],
) -> Result<TaskSession, SessionError>
pub async fn use_session_batch( &self, session_id: SessionId, tool_names: &[&str], ) -> Result<TaskSession, SessionError>
Atomically validate and record a batch of tool calls against the session.
Validates ALL tools and budget atomically under a single lock acquisition. No budget is consumed unless every tool in the batch passes validation.
Sourcepub async fn close(
&self,
session_id: SessionId,
) -> Result<TaskSession, SessionError>
pub async fn close( &self, session_id: SessionId, ) -> Result<TaskSession, SessionError>
Close a session.
Sourcepub async fn get(
&self,
session_id: SessionId,
) -> Result<TaskSession, SessionError>
pub async fn get( &self, session_id: SessionId, ) -> Result<TaskSession, SessionError>
Get a session by ID.
Sourcepub async fn list_all(&self) -> Vec<TaskSession>
pub async fn list_all(&self) -> Vec<TaskSession>
List all sessions.
Sourcepub async fn count_active_for_agent(&self, agent_id: Uuid) -> u64
pub async fn count_active_for_agent(&self, agent_id: Uuid) -> u64
Count the number of active sessions for a given agent.
P0: Used to enforce per-agent concurrent session caps.
Sourcepub async fn close_sessions_for_agent(&self, agent_id: Uuid) -> usize
pub async fn close_sessions_for_agent(&self, agent_id: Uuid) -> usize
Close all active sessions belonging to a specific agent.
Called during agent deactivation.
Sourcepub async fn cleanup_expired(&self) -> usize
pub async fn cleanup_expired(&self) -> usize
Remove expired sessions. Returns the number removed.
Trait Implementations§
Source§impl Clone for AnySessionStore
impl Clone for AnySessionStore
Source§fn clone(&self) -> AnySessionStore
fn clone(&self) -> AnySessionStore
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 AnySessionStore
impl !RefUnwindSafe for AnySessionStore
impl Send for AnySessionStore
impl Sync for AnySessionStore
impl Unpin for AnySessionStore
impl UnsafeUnpin for AnySessionStore
impl !UnwindSafe for AnySessionStore
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