Skip to main content

invoke

Function invoke 

pub fn invoke(
    doc: &mut AutoCommit,
    resources: &[Resource],
    address: &ActionAddress,
    argument: Option<&str>,
    provenance: InvocationProvenance<'_>,
    registry: &ActionRegistry,
    transport: &mut dyn ActionTransport,
) -> Result<Dispatched, DoorError>
Expand description

Perform the operation address names, attributed to provenance.actor. Resolve, bind, decode through the app’s own registry, then dispatch_by honouring the action’s locus. The actor is the caller’s Automerge actor bytes, so the room’s history names who asked; provenance.ambient carries the task or run the call belongs to. The resource’s concrete action label and address remain authoritative; app, purpose, group, and facets of the ambient context fill only fields the resource did not supply.

resources must be a tree built now, not the one an earlier survey walked — re-resolving turns an address that has since stopped naming anything into a refusal rather than an edit to whatever took its place. Decoding through registry (rather than trusting the tree) makes this fail-closed: an unregistered action type can’t run, and the decoder used here is the one a replaying peer would use too.

§Errors

Returns any error encode documents; DoorError::ConfirmationRequired when the action’s effective confirmation for this argument is not None (see invoke_confirmed); DoorError::UnregisteredType if registry has no decoder for the encoded action’s type; or DoorError::Failed if dispatch_by fails once decoded.