pub struct WorkflowEngine { /* private fields */ }Expand description
Thread-safe workflow engine that stores definitions and runs.
Implementations§
Source§impl WorkflowEngine
impl WorkflowEngine
Sourcepub async fn register_workflow(&self, workflow: WorkflowDefinition)
pub async fn register_workflow(&self, workflow: WorkflowDefinition)
Register a workflow definition. Overwrites if id already exists.
Sourcepub async fn get_workflow(
&self,
workflow_id: &str,
) -> Option<WorkflowDefinition>
pub async fn get_workflow( &self, workflow_id: &str, ) -> Option<WorkflowDefinition>
Get a registered workflow definition by id.
Sourcepub async fn start(
&self,
workflow_id: &str,
trigger_data: Value,
) -> Option<String>
pub async fn start( &self, workflow_id: &str, trigger_data: Value, ) -> Option<String>
Start a new run of the given workflow. Returns the run_id.
Returns None if the workflow id is not registered.
Sourcepub async fn advance(&self, run_id: &str) -> Result<bool, String>
pub async fn advance(&self, run_id: &str) -> Result<bool, String>
Advance a run to the next step. Evaluates the step condition, executes a simulated step, records the result, and moves the index forward.
Returns Ok(true) if the step was advanced, Ok(false) if the run
is already completed/failed/timed-out, and Err on unknown run id.
Sourcepub async fn get_run(&self, run_id: &str) -> Option<WorkflowRun>
pub async fn get_run(&self, run_id: &str) -> Option<WorkflowRun>
Retrieve the current state of a run.
Sourcepub async fn list_runs(&self, workflow_id: &str) -> Vec<WorkflowRun>
pub async fn list_runs(&self, workflow_id: &str) -> Vec<WorkflowRun>
List all runs for a given workflow id.
Sourcepub async fn run_to_completion(
&self,
run_id: &str,
) -> Result<WorkflowRun, String>
pub async fn run_to_completion( &self, run_id: &str, ) -> Result<WorkflowRun, String>
Run a workflow to completion (advance until done). Returns the final run state.
Applies an internal safety limit of 1000 iterations.
Trait Implementations§
Source§impl Clone for WorkflowEngine
impl Clone for WorkflowEngine
Source§fn clone(&self) -> WorkflowEngine
fn clone(&self) -> WorkflowEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkflowEngine
impl !RefUnwindSafe for WorkflowEngine
impl Send for WorkflowEngine
impl Sync for WorkflowEngine
impl Unpin for WorkflowEngine
impl UnsafeUnpin for WorkflowEngine
impl !UnwindSafe for WorkflowEngine
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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