pub struct InMemoryTaskStore { /* private fields */ }Expand description
In-memory TaskStore backed by a RwLock<HashMap>.
When at capacity and a new task id is inserted, the least recently
updated task is evicted (LRU). Re-inserting an existing id never evicts.
This is the default backend used by A2AServer.
Implementations§
Source§impl InMemoryTaskStore
impl InMemoryTaskStore
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a store with the default capacity (DEFAULT_MAX_TASKS).
Sourcepub fn with_max_tasks(max_tasks: usize) -> Self
pub fn with_max_tasks(max_tasks: usize) -> Self
Create a store with an explicit capacity cap.
Trait Implementations§
Source§impl Clone for InMemoryTaskStore
impl Clone for InMemoryTaskStore
Source§fn clone(&self) -> InMemoryTaskStore
fn clone(&self) -> InMemoryTaskStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryTaskStore
impl Debug for InMemoryTaskStore
Source§impl Default for InMemoryTaskStore
impl Default for InMemoryTaskStore
Source§impl TaskStore for InMemoryTaskStore
impl TaskStore for InMemoryTaskStore
Source§fn upsert<'life0, 'async_trait>(
&'life0 self,
stored: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert<'life0, 'async_trait>(
&'life0 self,
stored: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new task or replace an existing one.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a task snapshot by id, or
None if absent.Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List task snapshots matching
filter, ordered by creation (oldest first).Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a task by id. Returns
true if a task was actually removed.Source§fn compare_and_update<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
update: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compare_and_update<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
update: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically replace the stored task for
task_id when the currently
stored status may transition to the update’s status (per
TaskStatus::can_transition_to). Returns true when the update was
applied. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for InMemoryTaskStore
impl !UnwindSafe for InMemoryTaskStore
impl Freeze for InMemoryTaskStore
impl Send for InMemoryTaskStore
impl Sync for InMemoryTaskStore
impl Unpin for InMemoryTaskStore
impl UnsafeUnpin for InMemoryTaskStore
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