pub struct Setup { /* private fields */ }Expand description
What a scenario’s setup function builds for one seed: the workflows, the client’s requests and the checks.
Implementations§
Source§impl Setup
impl Setup
Sourcepub fn random(&mut self, n: u64) -> u64
pub fn random(&mut self, n: u64) -> u64
A number below n from the seed, to vary the scenario per seed.
Sourcepub fn register<I, O, F, Fut>(
&mut self,
workflow: impl AsWorkflow<I, O>,
f: F,
) -> &mut Self
pub fn register<I, O, F, Fut>( &mut self, workflow: impl AsWorkflow<I, O>, f: F, ) -> &mut Self
Registers a workflow type’s code (at the reference’s version, else
version 1). Inputs and results are JSON, as with
fusee::Engine::register.
Sourcepub fn object(&mut self, name: &str, handlers: ObjectHandlers) -> &mut Self
pub fn object(&mut self, name: &str, handlers: ObjectHandlers) -> &mut Self
Registers an object type with its handlers (see fusee::object).
Its keys are called by the client (call) and by
workflow code (ctx.object(type, key)).
Sourcepub fn call(
&mut self,
at: Duration,
wtype: &str,
key: &str,
handler: &str,
call_id: &str,
arg: &impl Serialize,
) -> &mut Self
pub fn call( &mut self, at: Duration, wtype: &str, key: &str, handler: &str, call_id: &str, arg: &impl Serialize, ) -> &mut Self
The client calls handler of key key of object type wtype at
at ([fusee::ObjectRef::call_with_id]). Until it is answered the
client sends it again, across crashes, with the same call_id; the
simulator fails the seed if two answers to one call ID differ (the
call ran twice). Outcome::call has the answer.
Sourcepub fn start(
&mut self,
at: Duration,
id: &str,
workflow: &str,
input: &impl Serialize,
) -> &mut Self
pub fn start( &mut self, at: Duration, id: &str, workflow: &str, input: &impl Serialize, ) -> &mut Self
The client starts id as a workflow at at after the
simulation begins. Until it is acknowledged the client retries,
across crashes, attaching to the existing run.
Sourcepub fn signal(
&mut self,
at: Duration,
id: &str,
name: &str,
payload: &impl Serialize,
) -> &mut Self
pub fn signal( &mut self, at: Duration, id: &str, name: &str, payload: &impl Serialize, ) -> &mut Self
The client signals id once its start was acknowledged; retries
carry one deduplication key, so the run receives it once.
Sourcepub fn read_stream(&mut self, at: Duration, id: &str, name: &str) -> &mut Self
pub fn read_stream(&mut self, at: Duration, id: &str, name: &str) -> &mut Self
A client reads stream name of id from at on, to its end,
connecting again at its offset after every crash. The simulator
checks that every reader of a stream sees the same chunk at each
offset (none changes or goes away after a crash), with no offset
skipped; Outcome::stream has what they saw.
Sourcepub fn debounce(
&mut self,
at: Duration,
workflow: &str,
key: &str,
event_id: &str,
input: &impl Serialize,
rule: &Debounce,
) -> &mut Self
pub fn debounce( &mut self, at: Duration, workflow: &str, key: &str, event_id: &str, input: &impl Serialize, rule: &Debounce, ) -> &mut Self
The client debounces a start of workflow under key at at
([fusee::Workflow::debounce_with_id]). Until it is acknowledged the
client sends it again, across crashes, with the same event_id; the
run it joined is in Outcome::receipt. The simulator checks that
every acknowledged event’s run starts and finishes.