pub struct JsonMachine<T: TypedMachine> { /* private fields */ }Expand description
The compiled machine of a TypedMachine with its load options, as
the typed world’s machine resource holds it: every actor started or
restored from it shares both.
Implementations§
Source§impl<T: TypedMachine> JsonMachine<T>
impl<T: TypedMachine> JsonMachine<T>
Sourcepub fn load(options: &str) -> Result<Self, String>
pub fn load(options: &str) -> Result<Self, String>
The compiled machine with load options (JSON, all optional):
{ "maxSteps": number, "maxTimers": number, "observeSystemEmitted": bool }. A typed machine
compiles its children and actions in, so it takes no children or
hostActions. An error is the contract’s { "code", "message" }:
options that do not parse are WORKFLOW_INVALID_INPUT, and a machine
that does not compile WORKFLOW_INVALID_MACHINE.
Sourcepub fn start(&self, options: &str, now: u64) -> Result<JsonActor<T>, String>
pub fn start(&self, options: &str, now: u64) -> Result<JsonActor<T>, String>
Starts an actor at now, with { "input"?, "id"? }, its root’s id
root unless it names one. An error is the contract’s
{ "code", "message" } (LoadOptions::start_json): a start whose
root fails is WORKFLOW_MACHINE_FAILED, and no actor.
Sourcepub fn restore(&self, snapshot: &str) -> Result<JsonActor<T>, String>
pub fn restore(&self, snapshot: &str) -> Result<JsonActor<T>, String>
Restores an actor from JsonActor::persist output: its input and
id are in the snapshot, the rest is the machine’s. Runs no actions.
An error is the contract’s { "code", "message" }
(LoadOptions::restore_json): a snapshot that does not restore is
WORKFLOW_INVALID_SNAPSHOT.