StepExecutor

Struct StepExecutor 

Source
pub struct StepExecutor;
Expand description

Orchestrates step execution within workflows

Handles:

  • Executing steps in dependency order
  • Managing step context and results
  • Handling step dependencies and waiting

Implementations§

Source§

impl StepExecutor

Source

pub fn execute_step( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, ) -> WorkflowResult<()>

Execute a single step

Marks the step as running, executes it, and records the result. Dispatches to the appropriate step type handler (agent, command, condition, parallel, approval).

Source

pub fn execute_workflow( workflow: &Workflow, state: &mut WorkflowState, ) -> WorkflowResult<()>

Execute steps in dependency order

Executes all steps in the workflow, respecting dependencies. Stops on first error unless error handling specifies otherwise.

Source

pub fn execute_next_step( workflow: &Workflow, state: &mut WorkflowState, ) -> WorkflowResult<Option<String>>

Execute the next available step

Finds and executes the next step that is ready to run. Returns the ID of the executed step, or None if no steps are ready.

Source

pub fn get_step_context( workflow: &Workflow, state: &WorkflowState, step_id: &str, ) -> WorkflowResult<Value>

Get step context for execution

Builds the context needed to execute a step, including:

  • Step configuration
  • Results from dependent steps
  • Workflow parameters
Source

pub fn fail_step( state: &mut WorkflowState, step_id: &str, error: String, ) -> WorkflowResult<()>

Mark a step as failed with error details

Source

pub fn skip_step(state: &mut WorkflowState, step_id: &str) -> WorkflowResult<()>

Mark a step as skipped

Source

pub fn get_step_status( state: &WorkflowState, step_id: &str, ) -> Option<StepStatus>

Get the status of a step

Source

pub fn is_step_completed(state: &WorkflowState, step_id: &str) -> bool

Check if a step has completed successfully

Source

pub fn is_step_failed(state: &WorkflowState, step_id: &str) -> bool

Check if a step has failed

Source

pub fn get_step_result( state: &WorkflowState, step_id: &str, ) -> Option<StepResult>

Get step result

Source

pub fn execute_condition_step( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, ) -> WorkflowResult<Vec<String>>

Execute a condition step and return the next steps to execute

Evaluates the condition and returns the list of step IDs that should be executed based on the condition result (then_steps or else_steps).

Source

pub fn get_condition_next_steps( workflow: &Workflow, state: &WorkflowState, step_id: &str, ) -> WorkflowResult<Vec<String>>

Get the next steps to execute after a condition step

Returns the list of step IDs that should be executed based on the condition result.

Source

pub fn requires_approval( workflow: &Workflow, step_id: &str, ) -> WorkflowResult<bool>

Check if a step requires approval

Returns true if the step has approval_required set to true.

Source

pub fn request_step_approval( approval_gate: &mut ApprovalGate, workflow: &Workflow, step_id: &str, ) -> WorkflowResult<String>

Request approval for a step

Creates an approval request for the step. The step will not execute until the approval is granted.

Source

pub fn is_step_approved( approval_gate: &ApprovalGate, request_id: &str, ) -> WorkflowResult<bool>

Check if a step has been approved

Returns true if the approval request has been approved. Returns error if the request is not found or timed out.

Source

pub fn is_step_rejected( approval_gate: &ApprovalGate, request_id: &str, ) -> WorkflowResult<bool>

Check if a step has been rejected

Returns true if the approval request has been rejected. Returns error if the request is not found or timed out.

Source

pub fn is_approval_pending( approval_gate: &ApprovalGate, request_id: &str, ) -> WorkflowResult<bool>

Check if approval is still pending

Returns true if the approval request is still pending.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.