Trait ActionHost
pub trait ActionHost {
// Required methods
fn query(
&self,
caller: &Caller,
query: CatalogueQuery,
) -> Pending<Result<CataloguePage, ActionHostError>> ⓘ;
fn invoke(
&self,
caller: &Caller,
request: InvokeRequest,
) -> Pending<Result<InvocationReceipt, ActionHostError>> ⓘ;
fn observe(
&self,
caller: &Caller,
id: &InvocationId,
) -> Option<InvocationState>;
fn cancel(
&self,
caller: &Caller,
id: &InvocationId,
) -> Pending<Result<(), ActionHostError>> ⓘ;
// Provided methods
fn retire_execution(&self, caller: &Caller) { ... }
fn next_change(
&self,
caller: &Caller,
id: &InvocationId,
) -> Option<Pending<()>> { ... }
fn confirm(
&self,
caller: &Caller,
request: &InvokeRequest,
) -> Pending<Result<ConfirmedInvocation, ActionHostError>> ⓘ { ... }
fn content_puts(&self) -> Option<Arc<dyn ContentPuts>> { ... }
fn record_reads(&self) -> Option<Arc<dyn RecordReads>> { ... }
fn record_changes(&self) -> Option<Arc<dyn RecordChanges>> { ... }
fn resource_search(&self) -> Option<Arc<dyn ResourceSearch>> { ... }
}Expand description
A peer that runs actions on behalf of authenticated remote callers.
Implementations resolve authority from caller alone and must be
idempotent per InvocationId: invoking an id again with the same
request reports the original invocation, with a different request fails
with ActionHostError::InvocationConflict. InvocationLedger
implements that rule.
Required Methods§
fn query(
&self,
caller: &Caller,
query: CatalogueQuery,
) -> Pending<Result<CataloguePage, ActionHostError>> ⓘ
fn query( &self, caller: &Caller, query: CatalogueQuery, ) -> Pending<Result<CataloguePage, ActionHostError>> ⓘ
One page of what caller is offered. An action the caller may not
invoke is absent, not flagged.
fn invoke(
&self,
caller: &Caller,
request: InvokeRequest,
) -> Pending<Result<InvocationReceipt, ActionHostError>> ⓘ
fn invoke( &self, caller: &Caller, request: InvokeRequest, ) -> Pending<Result<InvocationReceipt, ActionHostError>> ⓘ
Admit and start one invocation, or report the one already admitted
under the same id. Never blocks: the answer is the admission (an
accepted receipt, an immediate outcome, or a refusal) once the host
has it; completion is followed with Self::observe.
fn observe(&self, caller: &Caller, id: &InvocationId) -> Option<InvocationState>
fn observe(&self, caller: &Caller, id: &InvocationId) -> Option<InvocationState>
The latest state of an invocation caller started, or None for an
id this caller does not own.
fn cancel(
&self,
caller: &Caller,
id: &InvocationId,
) -> Pending<Result<(), ActionHostError>> ⓘ
fn cancel( &self, caller: &Caller, id: &InvocationId, ) -> Pending<Result<(), ActionHostError>> ⓘ
Ask a running invocation to stop, answered once the host has kept the request as durably as it keeps the invocation.
§Errors
Returns ActionHostError::UnknownInvocation for an id this caller
does not own, or ActionHostError::NotCancellable.
Provided Methods§
fn retire_execution(&self, caller: &Caller)
fn retire_execution(&self, caller: &Caller)
End this admitted transport run without cancelling its app jobs.
fn next_change(&self, caller: &Caller, id: &InvocationId) -> Option<Pending<()>>
fn next_change(&self, caller: &Caller, id: &InvocationId) -> Option<Pending<()>>
Resolves the next time invocation id (owned by caller) may have
changed state, so a waiter observes it again then instead of on a
timer. None when this host cannot tell; the caller then observes on
its own schedule.
Wakeups may be spurious: the waiter must observe
again and tolerate finding nothing new. A host that answers Some
must resolve it within a bounded interval even when nothing changes
(the broker’s is a second), so a change it failed to signal costs
latency, never a stalled waiter: a waiting answer (settle_with)
checks its deadline only when woken.
fn confirm(
&self,
caller: &Caller,
request: &InvokeRequest,
) -> Pending<Result<ConfirmedInvocation, ActionHostError>> ⓘ
fn confirm( &self, caller: &Caller, request: &InvokeRequest, ) -> Pending<Result<ConfirmedInvocation, ActionHostError>> ⓘ
Ask the person caller acts for to confirm request on their own
device, as the host shows it to them. The answer carries a
Confirmation::Witnessed that caller invokes request again
with, and the arguments as the person changed them, if they did
(ConfirmedInvocation::apply); a caller never confirms by its own
word. A host with nobody to ask answers
ActionHostError::ConfirmationRequired.
fn content_puts(&self) -> Option<Arc<dyn ContentPuts>>
fn content_puts(&self) -> Option<Arc<dyn ContentPuts>>
Where this host’s callers put content into their workspace’s content
store (ContentPuts); None for a host without one.
fn record_reads(&self) -> Option<Arc<dyn RecordReads>>
fn record_reads(&self) -> Option<Arc<dyn RecordReads>>
Where an agent task reads its workspace’s records outside their apps (RecordReads);
None for a host without them.
fn record_changes(&self) -> Option<Arc<dyn RecordChanges>>
fn record_changes(&self) -> Option<Arc<dyn RecordChanges>>
Where an agent task’s changes go to their records’ origin (RecordChanges).
fn resource_search(&self) -> Option<Arc<dyn ResourceSearch>>
fn resource_search(&self) -> Option<Arc<dyn ResourceSearch>>
The one search the desktop runs (ResourceSearch), which an
agent’s find asks: None for a host without a desktop’s search
(a standalone runtime speaks for no desk), which answers by its
apps’ own directories instead.
Implementations on Foreign Types§
§impl<H> ActionHost for Arc<H>where
H: ActionHost + ?Sized,
A shared host is the host: what lets one be handed to super::serve, which
keeps a handle for answers that wait.
impl<H> ActionHost for Arc<H>where
H: ActionHost + ?Sized,
A shared host is the host: what lets one be handed to super::serve, which
keeps a handle for answers that wait.