pub struct LoadOptions {
pub children: Map<String, Value>,
pub max_steps: usize,
pub max_timers: usize,
pub observe_system_emitted: bool,
pub host_actions: HostActions,
}Expand description
The options a machine is loaded with (JSON, all optional), which every actor started or restored from it shares, so a restore needs only the snapshot:
{ "children": { "<src>": MachineJSON }, // child machines for `invoke.src` (generic hosts)
"maxSteps": number, // bound on work per call (default DEFAULT_MAX_STEPS, 10000)
"maxTimers": number, // timers a time input fires at most in a chunk of control inputs alone (default 1000)
"observeSystemEmitted": bool, // every actor's emitted events, from the start or restore
"hostActions": true | [string] } // custom actions left to the host (generic hosts)maxTimers is the workflow contract’s run option (Actor::set_max_timers): every actor
started or restored from the machine takes it, so a run and its restore fire the same timers.
Fields§
§children: Map<String, Value>§max_steps: usize§max_timers: usize§observe_system_emitted: bool§host_actions: HostActionstrue is HostActions::Unimplemented: a generic host binds every
custom action to the host’s action implementation otherwise, so it
binds none then, and every custom action is the host’s. A list is
HostActions::Named; false or null is HostActions::None.
Implementations§
Source§impl LoadOptions
impl LoadOptions
Sourcepub fn parse(text: &str, generic: bool) -> Result<Self, String>
pub fn parse(text: &str, generic: bool) -> Result<Self, String>
Parses load options from text (empty for none). generic says
whether this host loads definitions at run time and so takes
children and hostActions (a typed machine compiles its children
and actions in); an option it does not take is an error.
Sourcepub fn parse_contract(text: &str, generic: bool) -> Result<Self, ApplyError>
pub fn parse_contract(text: &str, generic: bool) -> Result<Self, ApplyError>
LoadOptions::parse as a host’s load reports it: options that do
not parse are WORKFLOW_INVALID_INPUT.
Sourcepub fn start<C, E>(
&self,
machine: Arc<Machine<C, E>>,
start: StartOptions,
now: u64,
) -> Result<Actor<C, E>, ApplyError>
pub fn start<C, E>( &self, machine: Arc<Machine<C, E>>, start: StartOptions, now: u64, ) -> Result<Actor<C, E>, ApplyError>
Starts machine at now with these options and the start’s,
taking the input rather than copying it, as the workflow contract
starts a run: the root’s id is ROOT_ID unless the start names
one, the actor takes maxTimers, and a start whose root fails, so the
run has no state to go on from, is WORKFLOW_MACHINE_FAILED and no
actor. A now past 2^53 - 1 (MAX_TIME), which JavaScript does
not hold exactly, is WORKFLOW_INVALID_INPUT, as a time input past it
is.
Sourcepub fn start_json<C, E>(
&self,
machine: Arc<Machine<C, E>>,
options: &str,
now: u64,
) -> Result<Actor<C, E>, String>
pub fn start_json<C, E>( &self, machine: Arc<Machine<C, E>>, options: &str, now: u64, ) -> Result<Actor<C, E>, String>
LoadOptions::start of start options as JSON text (see
StartOptions::parse); the error is apply_error_json text,
options that do not parse WORKFLOW_INVALID_INPUT.
Sourcepub fn restore<C, E>(
&self,
machine: Arc<Machine<C, E>>,
snapshot: &Value,
) -> Result<Actor<C, E>, ApplyError>
pub fn restore<C, E>( &self, machine: Arc<Machine<C, E>>, snapshot: &Value, ) -> Result<Actor<C, E>, ApplyError>
Restores machine from snapshot with these options. A snapshot
that does not restore is WORKFLOW_INVALID_SNAPSHOT, and no actor.
Sourcepub fn restore_json<C, E>(
&self,
machine: Arc<Machine<C, E>>,
snapshot: &str,
) -> Result<Actor<C, E>, String>
pub fn restore_json<C, E>( &self, machine: Arc<Machine<C, E>>, snapshot: &str, ) -> Result<Actor<C, E>, String>
LoadOptions::restore of a snapshot as JSON text; the error is
apply_error_json text, WORKFLOW_INVALID_SNAPSHOT also of text
that is not JSON.