Skip to main content

Module node

Module node 

Source
Expand description

The node — the thinnest substrate primitive (D5 / R-node-thin).

Holds a fn handle + deps + the wave state machine; zero inspection cruft (naming/find/describe are the graph layer). Single-thread (D22) ⇒ the shared state lives in a graph-local arena behind Rc<RefCell<GraphCore>> (Core = graph handle + node id), !Send + !Sync.

Values cross the substrate erased as AnyValue (Rc<dyn Any>) — the Rust analogue of TS’s unknown (per-language impl, CLEAN-SLATE.md). A typed Node<T> facade re-types the boundary (downcast at cache/data).

§Borrow discipline (the Rust-vs-TS divergence)

TS has no runtime borrow check; here the wave engine must never hold a RefCell borrow across a call that re-enters a node — ctx.down re-enters the running node, and delivery re-enters downstream nodes. The rule throughout is clone the callable out, drop the borrow, then call (subscribers, dispatcher fns, dep handles). Short borrow_mut scopes mutate; calls happen borrow-free.

§Current substrate scope

The active substrate covers state / producer / derived nodes, two-phase DIRTY-to-DATA delivery, diamond joins, first-run gating, push-on-subscribe, lazy activation, ROM/RAM, INVALIDATE, PAUSE/RESUME locksets and pause modes, COMPLETE/ERROR/TEARDOWN terminal behavior, batch commit/rollback, LocalAsync boundaries, runtime rewire, pull/routed-up demand, ctx.rewire_next, and panic-to-ERROR recovery at the wave boundary. Every occurrence remains DATA; no-emit functions settle with substrate-synthesized undirty RESOLVED (D49).

Structs§

Core
A cloneable handle over a node slot in a shared graph arena. The reentrant wave-engine methods live here; each manages its own short borrow scopes so calls into other nodes (or back into this one via ctx.down) are never made while a borrow is held.
Node
The typed facade over the erased substrate node (D5). Re-types the boundary: cache()/set() downcast to T; deps are erased via Node::erased.
NodeOpts
Node construction options (substrate-level). Sugar/operator opts are the graph layer (D6/D24); this is the minimal substrate surface needed to select a pool (D20), a pause mode (R-pause-modes), and the dep-terminal propagation policy (R-deps-terminal).

Enums§

Pausable
PAUSE/RESUME backpressure mode (R-pause-modes). The OUTER gate over async-paused buffering (D44).
Status
Node lifecycle status (R-status-enum) — the source of truth for cache freshness.