pub struct WorkflowDefinition<D: WorkflowData> {
pub id: WorkflowId,
pub name: String,
pub steps: Vec<StepDefinition<D>>,
pub default_retry_policy: RetryPolicy,
pub default_timeout: Duration,
/* private fields */
}Expand description
Complete workflow definition
Fields§
§id: WorkflowId§name: String§steps: Vec<StepDefinition<D>>§default_retry_policy: RetryPolicy§default_timeout: DurationImplementations§
Source§impl<D: WorkflowData> WorkflowDefinition<D>
impl<D: WorkflowData> WorkflowDefinition<D>
pub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
pub fn add_step(self, step: StepDefinition<D>) -> Self
pub fn with_default_retry(self, policy: RetryPolicy) -> Self
pub fn with_default_timeout(self, timeout: Duration) -> Self
Sourcepub fn get_retry_policy<'a>(
&'a self,
step: &'a StepDefinition<D>,
) -> &'a RetryPolicy
pub fn get_retry_policy<'a>( &'a self, step: &'a StepDefinition<D>, ) -> &'a RetryPolicy
Get the retry policy for a step (step-specific or default)
Sourcepub fn get_timeout(&self, step: &StepDefinition<D>) -> Duration
pub fn get_timeout(&self, step: &StepDefinition<D>) -> Duration
Get the timeout for a step (step-specific or default)
Sourcepub fn validate(&mut self) -> Result<(), ValidationError>
pub fn validate(&mut self) -> Result<(), ValidationError>
Validate the workflow DAG structure and build dependency graph. Returns an error if:
- A step depends on a non-existent step
- There’s a cycle in the dependencies
On success, pre-computes reverse dependencies for O(1) dependent lookup.
Sourcepub fn get_dependent_indices(&self, step_id: &StepId) -> &[usize]
pub fn get_dependent_indices(&self, step_id: &StepId) -> &[usize]
Get indices of steps that depend on the given step
Sourcepub fn get_initial_step_indices(&self) -> &[usize]
pub fn get_initial_step_indices(&self) -> &[usize]
Get indices of steps with no dependencies
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for WorkflowDefinition<D>
impl<D> !RefUnwindSafe for WorkflowDefinition<D>
impl<D> Send for WorkflowDefinition<D>
impl<D> Sync for WorkflowDefinition<D>
impl<D> Unpin for WorkflowDefinition<D>
impl<D> UnsafeUnpin for WorkflowDefinition<D>
impl<D> !UnwindSafe for WorkflowDefinition<D>
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