pub struct DynamicExecutionPlan {
pub nodes: HashMap<String, WorkflowNode>,
pub edges: Vec<WorkflowEdge>,
pub entry: Option<String>,
}Expand description
Dynamic execution plan with DAG structure
Fields§
§nodes: HashMap<String, WorkflowNode>All nodes in the DAG
edges: Vec<WorkflowEdge>All edges in the DAG
entry: Option<String>Entry point node ID
Implementations§
Source§impl DynamicExecutionPlan
impl DynamicExecutionPlan
Sourcepub fn add_node(&mut self, node: WorkflowNode) -> Result<()>
pub fn add_node(&mut self, node: WorkflowNode) -> Result<()>
Add a node to the plan
Sourcepub fn add_edge(&mut self, edge: WorkflowEdge) -> Result<()>
pub fn add_edge(&mut self, edge: WorkflowEdge) -> Result<()>
Add an edge to the plan
Sourcepub fn get_entry_nodes(&self) -> Vec<&WorkflowNode>
pub fn get_entry_nodes(&self) -> Vec<&WorkflowNode>
Get nodes that have no incoming edges (starting points)
Sourcepub fn get_exit_nodes(&self) -> Vec<&WorkflowNode>
pub fn get_exit_nodes(&self) -> Vec<&WorkflowNode>
Get nodes that have no outgoing edges (endpoints)
Sourcepub fn get_outgoing_edges(&self, node_id: &str) -> Vec<&WorkflowEdge>
pub fn get_outgoing_edges(&self, node_id: &str) -> Vec<&WorkflowEdge>
Get outgoing edges from a node
Sourcepub fn get_incoming_edges(&self, node_id: &str) -> Vec<&WorkflowEdge>
pub fn get_incoming_edges(&self, node_id: &str) -> Vec<&WorkflowEdge>
Get incoming edges to a node
Sourcepub fn has_cycles(&self) -> bool
pub fn has_cycles(&self) -> bool
Check for cycles in the DAG
Sourcepub fn topological_sort(&self) -> Result<Vec<String>>
pub fn topological_sort(&self) -> Result<Vec<String>>
Topological sort (returns nodes in execution order) Returns Err if there are cycles
Sourcepub fn find_next_nodes(
&self,
current_node_id: &str,
context: &StepPrehookContext,
) -> Vec<String>
pub fn find_next_nodes( &self, current_node_id: &str, context: &StepPrehookContext, ) -> Vec<String>
Returns the next nodes whose edge conditions pass for the current context.
Sourcepub fn get_node(&self, node_id: &str) -> Option<&WorkflowNode>
pub fn get_node(&self, node_id: &str) -> Option<&WorkflowNode>
Returns one node by identifier.
Sourcepub fn is_completed(&self, state: &DagExecutionState) -> bool
pub fn is_completed(&self, state: &DagExecutionState) -> bool
Returns true when every exit node is marked completed in the execution state.
Trait Implementations§
Source§impl Clone for DynamicExecutionPlan
impl Clone for DynamicExecutionPlan
Source§fn clone(&self) -> DynamicExecutionPlan
fn clone(&self) -> DynamicExecutionPlan
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DynamicExecutionPlan
impl Debug for DynamicExecutionPlan
Source§impl Default for DynamicExecutionPlan
impl Default for DynamicExecutionPlan
Source§fn default() -> DynamicExecutionPlan
fn default() -> DynamicExecutionPlan
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DynamicExecutionPlan
impl<'de> Deserialize<'de> for DynamicExecutionPlan
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DynamicExecutionPlan
impl RefUnwindSafe for DynamicExecutionPlan
impl Send for DynamicExecutionPlan
impl Sync for DynamicExecutionPlan
impl Unpin for DynamicExecutionPlan
impl UnsafeUnpin for DynamicExecutionPlan
impl UnwindSafe for DynamicExecutionPlan
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request