pub struct Service {Show 13 fields
pub calls: BTreeMap<String, Vec<u64>>,
pub violations: Vec<String>,
pub total: u64,
pub seed: u64,
pub progress: BTreeMap<String, BTreeSet<u32>>,
pub stalled: BTreeSet<String>,
pub tokens: Vec<(String, String)>,
pub issued: BTreeMap<String, u32>,
pub ticks: BTreeMap<String, BTreeSet<u64>>,
pub reads: BTreeMap<String, Vec<u64>>,
pub reads_rerun: u32,
pub talk_calls: BTreeMap<String, u64>,
pub talk_failed: BTreeSet<String>,
}Expand description
A mock external service. It logs every call with its idempotency key and input. Responses differ per call, so a step that runs again yields a different value; if any later step had already run on the first value, the log shows one key called with two different inputs.
Fields§
§calls: BTreeMap<String, Vec<u64>>§violations: Vec<String>§total: u64§seed: u64§progress: BTreeMap<String, BTreeSet<u32>>Progress each step key reported through heartbeats.
stalled: BTreeSet<String>§tokens: Vec<(String, String)>Completion tokens handed out, in order: (workflow ID, token).
issued: BTreeMap<String, u32>§ticks: BTreeMap<String, BTreeSet<u64>>Runs seen per scheduled workflow ID.
reads: BTreeMap<String, Vec<u64>>Inputs of read-only calls per key. Reads may run on state a crash takes back, so a key read with different inputs is allowed; it is counted to show that read-only steps really run ahead of the disk.
reads_rerun: u32§talk_calls: BTreeMap<String, u64>Tokens a model step asked for per key, and the keys whose call failed once.
talk_failed: BTreeSet<String>Implementations§
Source§impl Service
impl Service
Sourcepub fn resume(&mut self, key: &str, start: u32)
pub fn resume(&mut self, key: &str, start: u32)
A step resumed from heartbeat progress start: it must be progress
the step reported (a crash may only take back newer progress).
pub fn report_progress(&mut self, key: &str, p: u32)
Sourcepub fn stall_once(&mut self, key: &str) -> bool
pub fn stall_once(&mut self, key: &str) -> bool
True once per key: the step stalls without heartbeats.
Sourcepub fn issue(&mut self, wf: &str, token: &str) -> Result<(), String>
pub fn issue(&mut self, wf: &str, token: &str) -> Result<(), String>
Hands out a completion token. The first attempt per workflow fails.
pub fn tick(&mut self, wf: &str, run: u64)
Sourcepub fn read(
&mut self,
key: &str,
input: u64,
fail_first: u32,
) -> Result<u64, String>
pub fn read( &mut self, key: &str, input: u64, fail_first: u32, ) -> Result<u64, String>
A read-only call: logged apart from calls with effects and never a
violation. Answers differ per call like Service::call.
Sourcepub fn token(&mut self, key: &str, i: usize) -> Result<u64, String>
pub fn token(&mut self, key: &str, i: usize) -> Result<u64, String>
A model’s next token: a new value on every call, as sampling gives (so a token generated again differs from the first). Fails once per even key at the third token.