Skip to main content

RunHandle

Struct RunHandle 

pub struct RunHandle<O> { /* private fields */ }
Expand description

A run, addressed by workflow ID.

Implementations§

§

impl<O: DeserializeOwned> RunHandle<O>

pub fn id(&self) -> &str

pub async fn started(&self) -> Result<()>

Waits until a run with this ID exists. A debounced or batched run starts only when its window closes; until then status is None and result fails with NotFound.

pub async fn signal<T: Serialize>( &self, signal: impl AsSignal<T>, value: &T, ) -> Result<()>

Sends a signal: run.signal(REVIEW, &true). Resolves once it is durable.

pub async fn result(&self) -> Result<O>

Waits for the run’s result.

pub async fn cancel(&self, reason: &str) -> Result<()>

Requests cancellation: every operation the code is waiting on fails with Error::Cancelled, and the code may run compensation.

pub async fn resume(&self) -> Result<()>

Resumes a run that paused because a step’s retries ran out (crate::Exhausted::Pause): the step runs again at once, with a fresh budget, on the code this process has now. Error::Rejected if nothing is paused.

pub async fn terminate(&self, reason: &str) -> Result<()>

Ends the run at once; its code stops.

pub async fn status(&self) -> Result<RunSummary>

The run’s summary; Error::NotFound if there is none.

pub async fn query<A: Serialize, R: DeserializeOwned>( &self, query: impl AsQuery<A, R>, arg: &A, ) -> Result<R>

Calls a query handler: run.query(STATUS, &()).await?. Its answer waits until the state it read is durable.

pub fn update<'a, A: Serialize + 'a, R: DeserializeOwned + 'a>( &'a self, update: impl AsUpdate<A, R> + 'a, arg: &'a A, ) -> Op<UpdateOptions, impl Make<UpdateOptions, Output = Result<R>, Fut = impl Future<Output = Result<R>> + 'a> + 'a> ⓘ

Sends an update and waits for its handler’s durable result; .id(id) makes a retried call get the recorded result instead of running the handler twice.

pub async fn reset(&self, before_step: &str) -> Result<()>

Starts a new run whose journal is this one’s cut before before_step.

pub async fn retry(&self) -> Result<()>

Runs a failed run again from its failed step: a reset before it (the steps before keep their results).

pub async fn describe(&self) -> Result<RunDetail>

The run’s summary and journal.

pub fn stream(&self, name: &str) -> StreamReader

A reader of the run’s stream name, from its first chunk (StreamReader::from picks another offset). It yields each chunk once it is durable, and ends once the stream is complete.

Trait Implementations§

§

impl<O> Clone for RunHandle<O>

§

fn clone(&self) -> Self

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<O> Debug for RunHandle<O>

§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<O> Freeze for RunHandle<O>

§

impl<O> !RefUnwindSafe for RunHandle<O>

§

impl<O> Send for RunHandle<O>

§

impl<O> Sync for RunHandle<O>

§

impl<O> Unpin for RunHandle<O>

§

impl<O> UnsafeUnpin for RunHandle<O>

§

impl<O> !UnwindSafe for RunHandle<O>

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.