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 with_read_refresh(self, read_refresh: ReadRefresh) -> Self
pub fn with_read_refresh(self, read_refresh: ReadRefresh) -> Self
Let a read of a principal’s user: bag count as keeping it alive.
Off by default. See ReadRefresh for what it costs and why the window
is not a bool; pair it with the RetentionPolicy a sweep will run
under, which ReadRefresh::halfway_through does from the policy
itself.
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 AsyncContextStateStore for InMemoryTaskStorage
impl AsyncContextStateStore for InMemoryTaskStorage
Source§fn load_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<ContextState, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<ContextState, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
user: keys. Read moreSource§fn remember<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
value: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Remembered, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn remember<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
value: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Remembered, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Source§fn forget<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn forget<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
key, reporting whether it held anything. Read moreSource§impl AsyncConversationStore for InMemoryTaskStorage
impl AsyncConversationStore for InMemoryTaskStorage
Source§fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
digest: Digest,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
digest: Digest,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Digest::covers_through, claiming the context for caller if it is
new. Read moreSource§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,
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,
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,
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,
Source§impl AsyncRetention for InMemoryTaskStorage
impl AsyncRetention for InMemoryTaskStorage
Source§fn sweep<'life0, 'life1, 'async_trait>(
&'life0 self,
policy: &'life1 RetentionPolicy,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Swept, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn sweep<'life0, 'life1, 'async_trait>(
&'life0 self,
policy: &'life1 RetentionPolicy,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Swept, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sweep under one set of guards.
Every map is locked for the whole sweep, in the order documented on
conversations. Phasing it — pick the ids, release, then delete — would
let a turn arrive on a context between the two and leave that context
with its tasks deleted and its conversation intact. A sweep runs once a
night against contexts nothing has touched for days, so holding the
store still for it costs nothing anyone will notice.
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,
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,
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,
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,
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,
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,
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,
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,
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> AsyncConversationStoreExt for Twhere
T: AsyncConversationStore + ?Sized,
impl<T> AsyncConversationStoreExt for Twhere
T: AsyncConversationStore + ?Sized,
Source§fn load_recent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
keep: u32,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_recent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
keep: u32,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
keep of the most recent messages.Source§fn compact_through<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
conversation: &'life3 Conversation,
summary: String,
model: String,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn compact_through<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
conversation: &'life3 Conversation,
summary: String,
model: String,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
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>
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,
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,
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,
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
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> ⓘ
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> ⓘ
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