pub struct DurableExecution<S: ExecutionStore> { /* private fields */ }Expand description
A durable execution workflow
Implementations§
Source§impl<S: ExecutionStore> DurableExecution<S>
impl<S: ExecutionStore> DurableExecution<S>
pub fn new(execution_id: impl Into<String>, store: Arc<S>) -> Self
pub fn with_config(self, config: DurableConfig) -> Self
Sourcepub fn add_step<F, Fut>(self, id: impl Into<String>, handler: F) -> Self
pub fn add_step<F, Fut>(self, id: impl Into<String>, handler: F) -> Self
Add a step to the execution
Sourcepub fn add_step_config(self, step: ExecutionStep) -> Self
pub fn add_step_config(self, step: ExecutionStep) -> Self
Add a pre-configured step
Sourcepub async fn run(&self) -> Result<ExecutionResult, DurableError>
pub async fn run(&self) -> Result<ExecutionResult, DurableError>
Run the execution (resumes from last completed step if interrupted)
Sourcepub async fn pause(&self) -> Result<(), DurableError>
pub async fn pause(&self) -> Result<(), DurableError>
Pause the execution (for manual resume later)
Sourcepub async fn state(&self) -> Result<Option<ExecutionState>, DurableError>
pub async fn state(&self) -> Result<Option<ExecutionState>, DurableError>
Get current state
Sourcepub async fn reset(&self) -> Result<(), DurableError>
pub async fn reset(&self) -> Result<(), DurableError>
Reset execution to start from beginning
Auto Trait Implementations§
impl<S> Freeze for DurableExecution<S>
impl<S> !RefUnwindSafe for DurableExecution<S>
impl<S> Send for DurableExecution<S>
impl<S> Sync for DurableExecution<S>
impl<S> Unpin for DurableExecution<S>
impl<S> UnsafeUnpin for DurableExecution<S>
impl<S> !UnwindSafe for DurableExecution<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more