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.