pub struct MemoryExecutionStore { /* private fields */ }Expand description
In-memory execution store for testing, development, and prototyping.
Tracks tool executions and token usage records in memory-backed
HashMaps protected by RwLock. Data is lost when the process exits.
Implements ExecutionStore.
Implementations§
Source§impl MemoryExecutionStore
impl MemoryExecutionStore
Sourcepub async fn set_message_count(&self, session_id: Uuid, count: u64)
pub async fn set_message_count(&self, session_id: Uuid, count: u64)
Sets the message count for a session, used by session_stats.
In a real backend this would be computed from a messages table; the in-memory store requires the caller to explicitly provide it since messages are maintained in the session store, not here.
Trait Implementations§
Source§impl Default for MemoryExecutionStore
impl Default for MemoryExecutionStore
Source§fn default() -> MemoryExecutionStore
fn default() -> MemoryExecutionStore
Returns the “default value” for a type. Read more
Source§impl ExecutionStore for MemoryExecutionStore
impl ExecutionStore for MemoryExecutionStore
Source§fn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = StoreResult<ToolExecution>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = StoreResult<ToolExecution>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Records a tool execution and returns it with server-assigned fields.
Source§fn list_executions<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_executions<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns all tool executions for a session ordered by creation time (ascending).
Source§fn list_executions_by_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_executions_by_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns all tool executions for a specific message ordered by creation time.
Source§fn record_usage<'life0, 'async_trait>(
&'life0 self,
record: UsageRecord,
) -> Pin<Box<dyn Future<Output = StoreResult<UsageRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_usage<'life0, 'async_trait>(
&'life0 self,
record: UsageRecord,
) -> Pin<Box<dyn Future<Output = StoreResult<UsageRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Records token usage for a single provider interaction.
Source§fn list_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<UsageRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<UsageRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns all usage records for a session ordered by creation time (ascending).
Source§fn session_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<SessionStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn session_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<SessionStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Computes aggregate statistics for a session. Read more
Source§fn delete_by_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_by_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = StoreResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes all executions and usage records for a session. Read more
Auto Trait Implementations§
impl !Freeze for MemoryExecutionStore
impl !RefUnwindSafe for MemoryExecutionStore
impl Send for MemoryExecutionStore
impl Sync for MemoryExecutionStore
impl Unpin for MemoryExecutionStore
impl UnsafeUnpin for MemoryExecutionStore
impl UnwindSafe for MemoryExecutionStore
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