pub trait HaltStore:
Send
+ Sync
+ 'static {
// Required methods
fn load(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredHalt>, A2aError>> + Send + '_>>;
fn put<'a>(
&'a self,
halt: &'a StoredHalt,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>;
fn remove<'a>(
&'a self,
scope: &'a HaltScope,
) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>;
// Provided methods
fn is_process_local(&self) -> bool { ... }
fn signals(&self) -> Option<Receiver<HaltSignal>> { ... }
fn publish_cancel<'a>(
&'a self,
tenant: &'a str,
task: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>> { ... }
}Expand description
Where halts are kept so that every replica sees them and a restart keeps them.
§Contract
putstoreshalt, replacing any halt of the same scope.removedeletes the halt of exactly that scope and says whether there was one; removingHaltScope::TenantleavesHaltScope::Allin place, and removingHaltScope::Rootleaves its tenant’s halt in place.- Every scope is kept,
HaltScope::Rootincluded: a store that keys scopes by a string uses one key per scope, as the SQL stores’ (all,tenant:<t>,root:<n>:<tenant><root>) do. loadreturns every halt stored, at most one per scope.- An error is an error: a store that cannot be read must not answer with no halts, since an empty list resumes every replica that polls it.
Required Methods§
Sourcefn load(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredHalt>, A2aError>> + Send + '_>>
fn load( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<StoredHalt>, A2aError>> + Send + '_>>
Provided Methods§
Sourcefn is_process_local(&self) -> bool
fn is_process_local(&self) -> bool
Whether this store keeps its state in this process alone.
The default is false: a store this crate cannot see into (yours, over
Redis, say) is taken to be shared. The in-memory ones answer true.
Profile::Production reads it:
on a task store that is shared between processes, a store that only this
process can see makes the fleet behave as if it had no store
(audit E-F13).
Sourcefn signals(&self) -> Option<Receiver<HaltSignal>>
fn signals(&self) -> Option<Receiver<HaltSignal>>
A subscription to this store’s pushed signals, or None (the
default) for a store that cannot push; the handler then polls only.
Sourcefn publish_cancel<'a>(
&'a self,
tenant: &'a str,
task: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn publish_cancel<'a>( &'a self, tenant: &'a str, task: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Tells every handler sharing this store that task in tenant was
cancelled. The default does nothing: without a push, the executor
running the task learns of it at its next refused write.
§Errors
When the signal cannot be sent.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".