Skip to main content

RunOptions

Struct RunOptions 

Source
#[non_exhaustive]
pub struct RunOptions<'a> { pub channel: Option<&'a str>, pub routing_bucket: Option<u8>, pub capture_changes: bool, pub audit: AuditMode, pub deadline: Option<Instant>, pub cancel: Option<&'a CancelToken>, pub layers: &'a [Arc<dyn CallLayer>], pub observer: Option<&'a dyn Observer>, pub trace: Option<TraceOptions>, }
Expand description

What a caller chooses about one run.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§channel: Option<&'a str>

Run the Active workflows of this channel; None runs every Active one.

§routing_bucket: Option<u8>

The bucket a rollout admits, 0..=99; a larger one is served as 99. None is admitted by every rollout.

§capture_changes: bool

Record each write’s Change in its task’s audit entry. true by default (#63). It governs only the audit trail: a trace records its own changes whatever it says.

§audit: AuditMode

Which audit entries the message keeps. Full by default.

§deadline: Option<Instant>

When the run must end; None by default. It is checked at every host call, every fan-out element’s start, every sweep and every CHECK_EVERY ops. Natively each host call also races it, on a Tokio timer, so a run with a deadline is polled inside a Tokio runtime with its time driver enabled. A call it cuts short, or that returns Err once it has passed, is recorded as TIMEOUT_ERROR on its task; either way the run ends TimedOut.

On wasm no timer exists, so nothing races a host call and it is never cut short mid-flight: a deadline that passes while a call runs is seen at the next check, after the call returns.

§cancel: Option<&'a CancelToken>

A token that cancels the run when it, or an ancestor, is cancelled; None by default. It is checked and raced where the deadline is, and first. A call it cuts short, or that returns Err once it is cancelled, is recorded as CANCELLED on its task; either way the run ends Cancelled.

§layers: &'a [Arc<dyn CallLayer>]

Layers around every host call of this run, outside the registry’s; the first is the outermost. None by default.

§observer: Option<&'a dyn Observer>

An observer of this run, beside the engine’s (EngineConfig::observer); None by default.

§trace: Option<TraceOptions>

Trace the run, as these options say: its Run::trace is then the initial context plus each step’s changes. None by default: no trace, and no copy of the context.

Implementations§

Source§

impl<'a> RunOptions<'a>

Source

pub fn channel(self, c: &'a str) -> Self

Runs the Active workflows of channel c.

Source

pub fn routing_bucket(self, b: u8) -> Self

Sets the routing bucket rollouts are tested against: 0..=99. A larger one is served as bucket 99, as in 3.x, so derive it as a hash % 100, never % 256.

Source

pub fn capture_changes(self, on: bool) -> Self

Turns the audit trail’s change capture on or off.

Source

pub fn audit(self, mode: AuditMode) -> Self

Sets which audit entries the message keeps.

Source

pub fn deadline(self, deadline: Instant) -> Self

Ends the run at deadline, as the deadline field says.

Source

pub fn cancel(self, token: &'a CancelToken) -> Self

Cancels the run when token is cancelled, as the cancel field says.

Source

pub fn layers(self, layers: &'a [Arc<dyn CallLayer>]) -> Self

Wraps every host call of the run in layers, outside the registry’s layers; the first is the outermost.

Source

pub fn observer(self, o: &'a dyn Observer) -> Self

Reports this run to o too, beside the engine’s observer.

Source

pub fn trace(self, opts: TraceOptions) -> Self

Traces the run under opts, as the trace field says.

Trait Implementations§

Source§

impl<'a> Clone for RunOptions<'a>

Source§

fn clone(&self) -> Self

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 RunOptions<'_>

Source§

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

Every option, the layers as a count and the observer as a presence.

Source§

impl Default for RunOptions<'_>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for RunOptions<'a>

§

impl<'a> !UnwindSafe for RunOptions<'a>

§

impl<'a> Freeze for RunOptions<'a>

§

impl<'a> Send for RunOptions<'a>

§

impl<'a> Sync for RunOptions<'a>

§

impl<'a> Unpin for RunOptions<'a>

§

impl<'a> UnsafeUnpin for RunOptions<'a>

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.