Skip to main content

DagPipeline

Struct DagPipeline 

Source
pub struct DagPipeline { /* private fields */ }
Expand description

The DAG pipeline definition.

Implementations§

Source§

impl DagPipeline

Source

pub fn new() -> Self

Creates a new DagPipeline.

Source

pub fn add_node(&mut self, node: DagNode) -> Result<(), DagError>

Add a node to the DAG.

Source

pub fn add_edge(&mut self, edge: DagEdge) -> Result<(), DagError>

Add an edge to the DAG.

Source

pub fn get_node(&self, id: u32) -> Option<&DagNode>

Get a node by ID.

Source

pub fn nodes(&self) -> &[DagNode]

Get all nodes.

Source

pub fn node_ids(&self) -> impl Iterator<Item = u32> + '_

Iterate present node IDs in deterministic ascending ID order.

Source

pub fn edges(&self) -> &[DagEdge]

Get all edges.

Source

pub fn downstream(&self, id: u32) -> &[u32]

Get the downstream nodes of a given node.

Source

pub fn upstream(&self, id: u32) -> &[u32]

Get the upstream nodes of a given node.

Source

pub fn has_cycle(&self) -> bool

Detect cycles using DFS. Returns true if a cycle is found.

Source

pub fn topological_sort(&self) -> Result<Vec<u32>, DagError>

Topological sort. Returns node IDs in dependency order. Returns Err if a cycle is detected.

Source

pub fn entry_nodes(&self) -> Vec<u32>

Get the entry nodes (nodes with no upstream dependencies).

Source

pub fn exit_nodes(&self) -> Vec<u32>

Get the exit nodes (nodes with no downstream dependencies).

Source

pub fn validate(&self, available_caps: &[String]) -> Result<(), DagError>

Validate the DAG: check for cycles, missing budgets on hot nodes, and missing capabilities.

Source

pub fn node_count(&self) -> usize

Number of nodes.

Source

pub fn edge_count(&self) -> usize

Number of edges.

Trait Implementations§

Source§

impl Default for DagPipeline

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,