pub struct Dag { /* private fields */ }Expand description
A directed acyclic graph of executable nodes.
Nodes are executed in topological order with maximum parallelism:
all nodes whose dependencies are satisfied run concurrently.
Use with_max_parallelism to limit
how many nodes execute simultaneously.
Implementations§
Source§impl Dag
impl Dag
Sourcepub fn with_max_parallelism(self, max: usize) -> Self
pub fn with_max_parallelism(self, max: usize) -> Self
Set the maximum number of nodes that can execute concurrently.
Sourcepub const fn with_failure_policy(self, policy: FailurePolicy) -> Self
pub const fn with_failure_policy(self, policy: FailurePolicy) -> Self
Set the failure handling policy.
Sourcepub fn add_edge(self, from: &str, to: &str) -> AppResult<Self>
pub fn add_edge(self, from: &str, to: &str) -> AppResult<Self>
Add a directed edge from one node to another.
Sourcepub fn topological_sort(&self) -> AppResult<Vec<String>>
pub fn topological_sort(&self) -> AppResult<Vec<String>>
Topological sort using Kahn’s algorithm.
Sourcepub async fn execute(
&self,
cancel: CancellationToken,
) -> AppResult<HashMap<String, Value>>
pub async fn execute( &self, cancel: CancellationToken, ) -> AppResult<HashMap<String, Value>>
Execute all nodes respecting dependency order with maximum parallelism.
Sourcepub async fn execute_with_inputs(
&self,
initial_inputs: HashMap<String, Value>,
cancel: CancellationToken,
) -> AppResult<HashMap<String, Value>>
pub async fn execute_with_inputs( &self, initial_inputs: HashMap<String, Value>, cancel: CancellationToken, ) -> AppResult<HashMap<String, Value>>
Execute with initial inputs provided to root nodes.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Dag
impl !UnwindSafe for Dag
impl Freeze for Dag
impl Send for Dag
impl Sync for Dag
impl Unpin for Dag
impl UnsafeUnpin for Dag
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