mod item

module item

Types

type ItemID

Variables

const ASSETS_NODE: ItemID

“assets”

const INPUT_NODE: ItemID

“input”

const META_NODE: ItemID
const PREVIOUS_EPOCH: ItemID

The interned id of the ("meta", "previous_epoch") signal.

Stateful nodes depend on it so they can’t run before their previous epoch completes; the scheduler controls when it is marked done. Every Interner interns it at construction, so it is always id 0.

const TUBE_NODE: ItemID

“tube” - The marker that indicates the root of an epoch, Epoch((“tube”, 0))

Functions

fn interner() -> Arc<Interner>

Get a read-only reference to the global python<->rust interner Acquired the RwLock only within the function call, releasing it immediately. See the top-level design docs for more details.

fn interner_mut() -> RwLockWriteGuard<'static, Arc<Interner>>

Get a read/write reference to the global python<->rust interner, holding the lock.

Update the interner by getting a new mutable Arc from it:

let mut interner_slot = interner_mut();
let interner = Arc::make_mut(&mut interner_slot);
fn resolve_or_intern_node(node_id: &str) -> ItemID

For use with Epoch - fast way to handle interned node_id -> int mappings We assume that most of the time we are constructing Epochs in the context of a scheduler, where all the node_ids will already be interned, so all we need to do is get a read-only view into the interner. To support random, python-like creation of Epochs, though, we automatically intern node ids that haven’t been: if there are no other references to the interner, as cheap as mutating the IndexMap. Otherwise, requires a copy.

Enums

enum Item

A graph item: either a node id, or a (node id, signal name) pair.

The native representation of noob.types.NodeID | noob.types.NodeSignal: a str or a 2-tuple of str on the python side.

Node(String)
Signal(String, String)

Implementations

impl Item

Functions

fn is_signal(&self) -> bool
fn node_id(&self) -> &str

The node id: itself for nodes, the node part for signals

Traits implemented

impl fmt::Display for Item

Structs and Unions

struct Interner

Interns Items to dense ItemID ids shared by all sorters in a scheduler, so that all graph algorithms operate on integers rather than strings.

Implementations

impl Interner

Functions

fn get(&self, item: &Item) -> Option<ItemID>
fn intern(&mut self, item: Item) -> ItemID
fn intern_node(&mut self, id: &str) -> ItemID
fn intern_signal(&mut self, node: &str, signal: &str) -> ItemID

Intern both the (node, signal) tuple and the node within it.

fn is_signal(&self, id: ItemID) -> bool
fn node_part(&self, id: ItemID) -> ItemID

For a signal item, the interned id of its node part. For a node item, its own id.

fn resolve(&self, id: ItemID) -> &Item

Return an integer ItemId to the python string form Panics if no item is present in the interner

Traits implemented

impl Default for Interner