mod sorter

module sorter

Structs and Unions

struct EdgeRec

The fields of noob.edge.Edge the sorter cares about. The boundary layer is responsible for extracting these from python.

source_node: String
source_signal: String
target_node: String
required: bool

Traits implemented

impl From<(&str, &str, &str, bool)> for EdgeRec
impl From<(&str, &str, &str)> for EdgeRec

Default edge to required

struct NodeFlags

The fields of noob.node.NodeSpecification the sorter cares about. stateful is bool | None in python - None (unresolved) is treated as stateless, see NodeFlags::is_stateful.

enabled: bool
stateful: Option<bool>

Implementations

impl NodeFlags

Functions

fn is_stateful(&self) -> bool

Statefulness with the None (unresolved) default flattened to stateless

struct NodeRec
nqueue: i64
successors: FxIndexSet<ItemID>
predecessors: FxIndexSet<ItemID>
optional_predecessors: FxIndexSet<ItemID>
optional_successors: FxIndexSet<ItemID>
struct Sorter

Port of noob.toposort.TopoSorter, operating on interned item ids.

Uses IndexSet/IndexMap rather than the std hash containers because their iteration is deterministic (reproducible scheduling and directly comparable test output, where std’s per-instance random hash seeds are not) and iterates a dense vec rather than sparse hash buckets. These sets are iterated constantly.

signals: FxHashMap<ItemID, FxIndexSet<ItemID>>

node item id -> signal items emitted by that node that the graph depends on

info: FxIndexMap<ItemID, NodeRec>

mirrors TopoSorter._node2info

ready: FxIndexSet<ItemID>
out: FxIndexSet<ItemID>
done: FxIndexSet<ItemID>
disabled: FxIndexSet<ItemID>
ran: FxIndexSet<ItemID>
npassedout: i64
nfinished: i64

Implementations

impl Sorter

Functions

fn add(&mut self, interner: &mut Interner, node: ItemID, predecessors: &[ItemID], required: bool) -> CoreResult<()>
fn clone_state(&self) -> SorterState

Get a cloned version of the internal sorter state This is an expensive method, since it clones… everything To be used when debugging

fn done(&mut self, interner: &Interner, nodes: &[ItemID]) -> CoreResult<()>
fn find_cycle(&self) -> Option<Vec<ItemID>>
fn from_graph(interner: &mut Interner, nodes: &FxIndexMap<String, NodeFlags>, edges: &[EdgeRec]) -> CoreResult<Sorter>

Port of TopoSorter.__init__ from a node map and edge list

fn get_nodeinfo(&mut self, id: ItemID) -> &mut NodeRec
fn get_ready(&mut self, interner: &Interner) -> Vec<ItemID>
fn is_active(&self) -> bool
fn mark_expired(&mut self, nodes: &[ItemID], unlock_optionals: bool)
fn mark_out(&mut self, nodes: &FxIndexSet<ItemID>)
fn mark_ready(&mut self, nodes: &[ItemID])
fn resurrect(&mut self, interner: &Interner, nodes: &[ItemID]) -> CoreResult<()>
fn source_nodes(&self) -> FxIndexSet<ItemID>

Nodes within the graph that have no dependencies (except PREVIOUS_EPOCH)

struct SorterState

Independent, cloned state of the sorter to be used when debugging

ready: FxHashSet<ItemID>
out: FxHashSet<ItemID>
done: FxHashSet<ItemID>
disabled: FxHashSet<ItemID>
ran: FxHashSet<ItemID>
pending: FxHashSet<ItemID>
npassedout: i64
nfinished: i64