pub struct WorkflowEngine<S: DurableStore> { /* private fields */ }Implementations§
Source§impl<S: DurableStore> WorkflowEngine<S>
impl<S: DurableStore> WorkflowEngine<S>
pub fn new( queue: Queue, store: S, worker_id: String, lease_ttl: Duration, priority: Priority, ) -> Self
Sourcepub fn register_workflow(
&self,
workflow: Workflow,
bodies: Vec<StepFunc>,
) -> Result<(), EngineError>
pub fn register_workflow( &self, workflow: Workflow, bodies: Vec<StepFunc>, ) -> Result<(), EngineError>
Registers a workflow’s step bodies without running anything, so a
later recover call (after a process restart) has
something to re-admit an interrupted step into.
Sourcepub async fn run(
&self,
workflow: Workflow,
bodies: Vec<StepFunc>,
) -> Result<(), EngineError>
pub async fn run( &self, workflow: Workflow, bodies: Vec<StepFunc>, ) -> Result<(), EngineError>
Runs all steps in order, recording events and honoring per-step retry policy.
Stops (without error) at the first step that enters
StepStatus::Waiting — the workflow stays registered so a later
Self::resume can continue it from that point.
Sourcepub async fn cancel(
&self,
workflow_id: &str,
reason: String,
) -> Result<(), EngineError>
pub async fn cancel( &self, workflow_id: &str, reason: String, ) -> Result<(), EngineError>
Unblocks a step in StepStatus::Waiting, supplying opaque input
for its next run, then continues driving the remaining steps in
order — stopping again if a later step also enters Waiting.
Records Event::WorkflowCancelled and un-registers the workflow so the
engine will not claim or schedule further steps.
Idempotent: if the workflow already has a terminal event
(Event::WorkflowCompleted, Event::WorkflowFailed, or
Event::WorkflowCancelled), returns Ok(()) without appending
anything.
Cancellation does not abort a step attempt already pushed to the V1
Queue and executing in a worker — V1 has no in-flight abort. Side
effects from that run may still occur. While driving steps, cancellation
is observed at the next step boundary (and between retry attempts for
the current step); a body already running on the queue is not stopped.
pub async fn resume( &self, workflow_id: &str, step_index: usize, input: String, ) -> Result<(), EngineError>
Sourcepub fn resume_input(
&self,
workflow_id: &str,
step_index: usize,
) -> Option<String>
pub fn resume_input( &self, workflow_id: &str, step_index: usize, ) -> Option<String>
Opaque input from the most recent Event::StepResumed for this step in
durable storage, if any.