Struct RunHandle
pub struct RunHandle<O> { /* private fields */ }Expand description
A run, addressed by workflow ID.
Implementations§
§impl<O: DeserializeOwned> RunHandle<O>
impl<O: DeserializeOwned> RunHandle<O>
pub fn id(&self) -> &str
pub async fn started(&self) -> Result<()>
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<()>
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 cancel(&self, reason: &str) -> 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<()>
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 status(&self) -> Result<RunSummary>
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>
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> ⓘ
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<()>
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<()>
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 fn stream(&self, name: &str) -> StreamReader
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.