Skip to main content

StepOptions

Struct StepOptions 

pub struct StepOptions {
    pub retry: RetryPolicy,
    pub timeout: Option<Duration>,
    pub heartbeat_timeout: Option<Duration>,
    pub limit: Option<String>,
    pub priority: Priority,
    pub read_only: bool,
    pub own_value: bool,
}

Fields§

§retry: RetryPolicy§timeout: Option<Duration>

Each attempt fails (and may be retried) if it runs longer than this.

§heartbeat_timeout: Option<Duration>

An attempt fails (and may be retried) if this long passes without a ctx.heartbeat from it.

§limit: Option<String>

Take a permit of this limit before each attempt runs.

§priority: Priority

While waiting for the limit’s permit: higher levels go first, and steps of one level take turns by fairness key (see crate::limits). Not journaled; the default is arrival order.

§read_only: bool

The step only reads: its function changes nothing outside the process, so it may run before the records ahead of it are durable (it skips its gate). A crash can then make it run again with different inputs, which is harmless for a read and wrong for anything else. Its result is recorded like any step’s, and later steps and outputs still wait for it to be durable. Ignored by await_completion.

§own_value: bool

A live attempt’s result is returned as the step function produced it instead of decoded from the JSON recorded for it (replay still decodes). Saves the decode, about 4% of a memory step, but code then sees, for a type whose JSON round trip loses something, what replay would not give it. Off by default.

Implementations§

§

impl StepOptions

pub fn own_value(self) -> Self

See own_value.

pub fn read_only(self) -> Self

See read_only.

pub fn retry(self, retry: RetryPolicy) -> Self

pub fn timeout(self, timeout: Duration) -> Self

pub fn heartbeat_timeout(self, timeout: Duration) -> Self

pub fn limit(self, name: &str) -> Self

pub fn limit_by(self, name: &str, key: &str) -> Self

A limit per key: the permits of name for this key only (a tenant, an account), each key with the size engine.limit(name, …) gives, made on first use.

pub fn priority(self, level: i32) -> Self

Waits for the limit’s permit ahead of steps with a lower level (default 0).

pub fn fairness(self, key: &str) -> Self

Steps waiting for the limit’s permit at one level take turns by this key (a tenant ID, say), so a key with a deep backlog cannot starve the others.

pub fn fairness_weight(self, weight: u32) -> Self

Permits the fairness key takes per turn (default 1).

Trait Implementations§

§

impl Clone for StepOptions

§

fn clone(&self) -> StepOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for StepOptions

§

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

Formats the value using the given formatter. Read more
§

impl Default for StepOptions

§

fn default() -> StepOptions

Returns the “default value” for a type. Read more
§

impl PartialEq for StepOptions

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for StepOptions

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.