pub struct TaskStore { /* private fields */ }Expand description
In-memory storage for finished A2A tasks.
Each record carries the authenticated user that started the task, or None
when no authentication was configured. Owner-scoped reads
(get_for) only return a record to the same principal.
Records are evicted according to the store’s A2aTaskRetention.
Implementations§
Source§impl TaskStore
impl TaskStore
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a store with the default A2aTaskRetention.
Sourcepub fn with_retention(retention: A2aTaskRetention) -> Self
pub fn with_retention(retention: A2aTaskRetention) -> Self
Creates a store that evicts records according to retention.
Sourcepub async fn store(&self, task: Task)
pub async fn store(&self, task: Task)
Stores task without an owner.
An ownerless record is visible only to unauthenticated callers. Use
store_for to record the principal that started it.
Sourcepub async fn store_for(&self, owner: Option<&str>, task: Task)
pub async fn store_for(&self, owner: Option<&str>, task: Task)
Stores task as owned by owner, then applies the retention policy.
Sourcepub async fn get(&self, task_id: &str) -> Option<Task>
pub async fn get(&self, task_id: &str) -> Option<Task>
Returns a stored task regardless of its owner.
This is for programmatic access by the server operator; request handlers
use get_for.
Sourcepub async fn get_for(&self, owner: Option<&str>, task_id: &str) -> Option<Task>
pub async fn get_for(&self, owner: Option<&str>, task_id: &str) -> Option<Task>
Returns a stored task only when it belongs to owner.
A task owned by someone else is reported exactly like a missing one, so the response does not disclose that the ID exists.
Sourcepub async fn remove(&self, task_id: &str) -> Option<Task>
pub async fn remove(&self, task_id: &str) -> Option<Task>
Removes a stored task regardless of its owner.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TaskStore
impl !RefUnwindSafe for TaskStore
impl Forget for TaskStore
impl Move for TaskStore
impl Send for TaskStore
impl Sync for TaskStore
impl Unpin for TaskStore
impl UnsafeUnpin for TaskStorewhere
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const Waiter is !null: UnsafeUnpin,
Align8<usize>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, StoredTask)>: UnsafeUnpin,
impl UnwindSafe for TaskStorewhere
Mutex<Waitlist>: UnwindSafe,
AtomicUsize: UnwindSafe,
HashMap<String, StoredTask>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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