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§
Source§impl InMemoryTaskStore
impl InMemoryTaskStore
Sourcepub fn new() -> InMemoryTaskStore
pub fn new() -> InMemoryTaskStore
Create a new, empty in-memory store.
Trait Implementations§
Source§impl Default for InMemoryTaskStore
impl Default for InMemoryTaskStore
Source§fn default() -> InMemoryTaskStore
fn default() -> InMemoryTaskStore
Returns the “default value” for a type. Read more
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
'life0: 'async_trait,
InMemoryTaskStore: 'async_trait,
fn insert<'life0, 'async_trait>(
&'life0 self,
task: Task,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryTaskStore: '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 !UnwindSafe 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