pub struct InMemoryTaskStore { /* private fields */ }Expand description
A simple in-memory TaskStore backed by a tokio::sync::Mutex.
Suitable for development, testing, and single-node deployments. For production use with multiple server instances, swap in a database-backed implementation.
Implementations§
Trait Implementations§
Source§impl Default for InMemoryTaskStore
impl Default for InMemoryTaskStore
Source§impl TaskStore for InMemoryTaskStore
impl TaskStore for InMemoryTaskStore
Source§fn insert<'life0, 'async_trait>(
&'life0 self,
task: Task,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert<'life0, 'async_trait>(
&'life0 self,
task: Task,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new task into the store.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, A2aError>> + 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<Task>, A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a task by ID, returning
None if it does not exist.Source§fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
status: TaskStatus,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
status: TaskStatus,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update a task’s status and broadcast a
TaskStatusUpdateEvent.Source§fn add_artifact<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
artifact: Artifact,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_artifact<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
artifact: Artifact,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append an artifact to a task and broadcast a
TaskArtifactUpdateEvent.Source§fn append_message<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_message<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append a message to an existing task’s history.
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ListTasksRequest,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResponse, A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ListTasksRequest,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResponse, A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List tasks with cursor-based pagination and optional filters.
Source§fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancel a task. Returns an error if the task is in a terminal state.
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Receiver<StreamResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Receiver<StreamResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to streaming events for a task. Returns
None if the task
does not exist or has no broadcast channel.Auto Trait Implementations§
impl !Freeze for InMemoryTaskStore
impl !RefUnwindSafe for InMemoryTaskStore
impl Send for InMemoryTaskStore
impl Sync for InMemoryTaskStore
impl Unpin for InMemoryTaskStore
impl UnsafeUnpin for InMemoryTaskStore
impl !UnwindSafe 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