pub struct InMemoryTaskStorage { /* private fields */ }Expand description
Simple in-memory task storage for testing and example purposes.
Persistence-only: streaming fan-out lives in
InMemoryStreamingHandler and
push-webhook delivery behind the AsyncPushNotifier port (this struct hands
out its registry via push_notifier). The store still
owns push-config CRUD (AsyncNotificationManager) because that is config
persistence.
Implementations§
Source§impl InMemoryTaskStorage
impl InMemoryTaskStorage
Sourcepub fn with_push_sender(
push_sender: impl PushNotificationSender + 'static,
) -> Self
pub fn with_push_sender( push_sender: impl PushNotificationSender + 'static, ) -> Self
Create a new task storage with a custom push notification sender
Sourcepub fn push_notifier(&self) -> Arc<dyn AsyncPushNotifier>
pub fn push_notifier(&self) -> Arc<dyn AsyncPushNotifier>
Hand out this store’s push-notification registry as an
AsyncPushNotifier.
The returned notifier shares the same config registry the store writes to
via AsyncNotificationManager::set_config, so a config registered on
the store is immediately visible to the notifier at the composition edge.
Trait Implementations§
Source§impl AsyncNotificationManager for InMemoryTaskStorage
impl AsyncNotificationManager for InMemoryTaskStorage
Source§fn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create or replace a push-notification config, returning it with any
server-assigned ID populated.
Source§fn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 GetTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 GetTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a push-notification config for a task.
Source§fn list_configs<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTaskPushNotificationConfigsParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_configs<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTaskPushNotificationConfigsParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all push-notification configs for a task.
Source§fn delete_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 DeleteTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 DeleteTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a push-notification config. Idempotent per the v1.0.0 spec.
Source§impl AsyncTaskLifecycle for InMemoryTaskStorage
impl AsyncTaskLifecycle for InMemoryTaskStorage
Source§fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
context_id: &'life2 ContextId,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
context_id: &'life2 ContextId,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new task in the given context.
Source§fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update task status, optionally appending a message to history.
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether a task exists.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a task by ID with optional history length limit.
Source§impl AsyncTaskQuery for InMemoryTaskStorage
impl AsyncTaskQuery for InMemoryTaskStorage
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTasksParams,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTasksParams,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List tasks with filtering and pagination (A2A v1.0.0
tasks/list).Source§impl AsyncTaskVersioning for InMemoryTaskStorage
impl AsyncTaskVersioning for InMemoryTaskStorage
Source§fn version<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<u64, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn version<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<u64, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Current stored version of a task. Bumped on every successful mutation.
Source§fn get_versioned<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_versioned<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a task together with its current version (history-limited as in
AsyncTaskLifecycle::get).Source§fn update_status_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
expected: u64,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
expected: u64,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update status only if the stored version equals
expected. Read moreSource§impl Clone for InMemoryTaskStorage
impl Clone for InMemoryTaskStorage
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryTaskStorage
impl !UnwindSafe for InMemoryTaskStorage
impl Freeze for InMemoryTaskStorage
impl Send for InMemoryTaskStorage
impl Sync for InMemoryTaskStorage
impl Unpin for InMemoryTaskStorage
impl UnsafeUnpin for InMemoryTaskStorage
Blanket Implementations§
Source§impl<T> AsyncNotificationManagerExt for Twhere
T: AsyncNotificationManager + ?Sized,
impl<T> AsyncNotificationManagerExt for Twhere
T: AsyncNotificationManager + ?Sized,
Source§fn validate_config(
&self,
config: &TaskPushNotificationConfig,
) -> Result<(), A2AError>
fn validate_config( &self, config: &TaskPushNotificationConfig, ) -> Result<(), A2AError>
Validate a push-notification config’s webhook URL.
Source§fn set_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate the task ID and webhook URL, then store the config.
Source§impl<T> AsyncTaskLifecycleExt for Twhere
T: AsyncTaskLifecycle + ?Sized,
impl<T> AsyncTaskLifecycleExt for Twhere
T: AsyncTaskLifecycle + ?Sized,
Source§fn get_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskQueryParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskQueryParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate query parameters, then fetch the task.
Source§fn cancel_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskIdParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskIdParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate ID parameters, then cancel the task.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more