Skip to main content

Op

Struct Op 

pub struct Op<O, M: Make<O>> { /* private fields */ }
Expand description

An operation with options O, set by its builder methods, that runs when awaited: ctx.step("charge", f).retry(policy).await.

Implementations§

§

impl<M: Make<StepOptions>> Op<StepOptions, M>

pub fn own_value(self) -> Self

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

How failures are retried (default: RetryPolicy::default).

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

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

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

An attempt fails if this long passes without a ctx.heartbeat.

pub fn read_only(self) -> Self

The step only reads: it may run before the records ahead of it are durable (see StepOptions::read_only).

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

Takes a permit of this limit before each attempt.

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

Takes a permit of name for this key only: each key (a tenant, an account) has its own permits, of the size engine.limit(name, …) gives, made on first use.

ⓘ
ctx.step("sync", || api.sync(&tenant)).limit_by("tenant", &tenant).await?;

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

Waits for the limit’s permit ahead of steps with a lower level.

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

Steps waiting at one level take turns by this key.

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

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

§

impl<M: Make<WaitOptions>> Op<WaitOptions, M>

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

§

impl<M: Make<ChildOptions>> Op<ChildOptions, M>

pub fn parent_close(self, close: ParentClose) -> Self

What happens to the child when this workflow closes.

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

The child’s own deadline.

§

impl<O, M: Make<O>> Op<O, M>

pub fn options(self, options: O) -> Self

Replaces every option at once.

§

impl<M: Make<StartOptions>> Op<StartOptions, M>

Options of a start (see Engine::start).

pub fn id_policy(self, policy: IdPolicy) -> Self

What happens when the workflow ID is taken.

pub fn use_existing(self) -> Self

Attaches to a run of this ID that is still going (a client that retries a start should).

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

The run’s deadline from now.

pub fn version(self, version: u32) -> Self

The version to run (default: the newest registered).

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

Starts the run after delay instead of now: a durable timer, then the start (crate::delay). result() waits through the delay.

pub fn at(self, at: SystemTime) -> Self

Starts the run at at instead of now (delay).

pub fn trace(self, traceparent: impl Into<String>) -> Self

The W3C traceparent the run joins (StartOptions::trace).

pub fn concurrency_key(self, key: impl Into<String>) -> Self

The key a limit on runs at once counts by (StartOptions::concurrency_key).

§

impl<M: Make<EventOptions>> Op<EventOptions, M>

pub fn event_id(self, id: &str) -> Self

§

impl<M: Make<UpdateOptions>> Op<UpdateOptions, M>

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

pub fn start_options(self, start: StartOptions) -> Self

For update-with-start: the start’s options.

§

impl<M: Make<CallOptions>> Op<CallOptions, M>

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

Trait Implementations§

§

impl<O, M: Make<O>> Future for Op<O, M>

§

type Output = <M as Make<O>>::Output

The type of value produced on completion.
§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<M::Output>

Attempts to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more

Auto Trait Implementations§

§

impl<O, M> Freeze for Op<O, M>
where O: Freeze, M: Freeze, <M as Make<O>>::Fut: Freeze,

§

impl<O, M> RefUnwindSafe for Op<O, M>
where O: RefUnwindSafe, M: RefUnwindSafe, <M as Make<O>>::Fut: RefUnwindSafe,

§

impl<O, M> Send for Op<O, M>
where O: Send, M: Send, <M as Make<O>>::Fut: Send,

§

impl<O, M> Sync for Op<O, M>
where O: Sync, M: Sync, <M as Make<O>>::Fut: Sync,

§

impl<O, M> Unpin for Op<O, M>
where O: Unpin, M: Unpin, <M as Make<O>>::Fut: Unpin,

§

impl<O, M> UnsafeUnpin for Op<O, M>
where O: UnsafeUnpin, M: UnsafeUnpin, <M as Make<O>>::Fut: UnsafeUnpin,

§

impl<O, M> UnwindSafe for Op<O, M>
where O: UnwindSafe, M: UnwindSafe, <M as Make<O>>::Fut: UnwindSafe,

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> 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<F> IntoFuture for F
where F: Future,

Source§

type Output = <F as Future>::Output

The output that the future will produce on completion.
Source§

type IntoFuture = F

Which kind of future are we turning this into?
Source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
Source§

impl<T> Same for T

Source§

type Output = T

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