Skip to main content

Schedule

Struct Schedule 

Source
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

Source

pub fn wait_ms(&self, attempt: u32) -> u64

Deterministic wait after failed attempt n (1-based), before any jitter or Retry-After override.

Source

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).

Trait Implementations§

Source§

impl Clone for Schedule

Source§

fn clone(&self) -> Schedule

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schedule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Schedule

Source§

fn default() -> Self

The contract default: exp(200ms, x2, max 30s, jitter).

Source§

impl<'de> Deserialize<'de> for Schedule

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromStr for Schedule

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Schedule

Source§

fn eq(&self, other: &Schedule) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Schedule

Source§

impl TryFrom<String> for Schedule

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: String) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.