pub struct Schedule {
pub segments: Vec<ScheduleSegment>,
}Expand description
A retry schedule per contracts/schedule-grammar.ebnf — the full algebra:
one or more andThen-separated segments, each an exp/fixed primary
with an optional cumulative-wait bound (upTo). Semantics are pinned
normatively in conformance/README.md (“Schedule algebra”): upTo bounds
the segment’s cumulative natural wait and hands off to the next segment;
every segment except the last must be bounded and the last never is (both
degenerate shapes are configure-time KEEL-E001), so a schedule is always
a total mapping attempt → wait.
Fields§
§segments: Vec<ScheduleSegment>Non-empty; the parser enforces up_to_ms.is_some() on every segment
except the last and None on the last.
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub fn wait_ms(&self, attempt: u32) -> u64
pub fn wait_ms(&self, attempt: u32) -> u64
Deterministic wait after failed attempt n (1-based), before any
jitter or Retry-After override.
Sourcepub fn wait_and_jitter(&self, attempt: u32) -> (u64, bool)
pub fn wait_and_jitter(&self, attempt: u32) -> (u64, bool)
(wait, jitter?) for retry attempt n — a pure function of n, per
the normative walk in conformance/README.md (“Schedule algebra”):
segments hand off when the next natural wait would push the segment’s
cumulative emitted total past its upTo bound (an exact fit stays;
handoffs cascade past segments whose bound is below their first wait),
and each segment restarts at local attempt 1 on entry. The jitter flag
is the emitting segment’s — the stubs ignore it (virtual clocks); the
real core samples equal jitter, uniform in [w/2, w].
§Panics
If segments is empty (unrepresentable via the parser).