Skip to main content

Module dispatcher

Module dispatcher 

Source
Expand description

The dispatcher — first-class invoke funnel + pool host (D20 / D21).

F-SYNC-CORE: Dispatcher::invoke is synchronous and returns (). The wave-protocol core never blocks on async; async lives only in pools (LocalAsync, a later slice) and the wire bridge.

F-DISPATCH-ALL: every node fn goes through the dispatcher — no inline-fn bypass. A fn is registered into a pool and addressed by a pure-data Handle (pool_id, handle_id) (D7).

Slice scope: LocalSync + LocalAsync pools (D20). The async pool’s invoke is ALSO sync void (R-sync-core) — “async” is a node-kind LABEL, not a different call mechanism: an async fn kicks off work and emits LATER via a stashed crate::ctx::DeferredCtx (the Rust analogue of TS capturing ctx). The grouped DispatcherOpts (DR-6) and the opt-in profile recorder (D39) land in later slices.

Re-exports§

pub use crate::protocol::Handle;

Structs§

Dispatcher
First-class dispatcher (D21), cloneable handle over shared inner state. A graph binds one; the default is a thread-local singleton (D26).
ProfileStat
Per-handle accumulated profile counters (D39).

Enums§

PoolKind
Pool kind label. LocalSync + LocalAsync ship in 1.0 (D20). The kind drives the NODE’S behavior (async-paused buffering / per-invocation ctx snapshot — see crate::node); the dispatcher invoke is sync void either way (R-sync-core).

Constants§

ASYNC_POOL_ID
The LocalAsync pool id (D20).
SYNC_POOL_ID
The LocalSync pool id (D20).

Functions§

default_dispatcher
A clone of the thread-local default dispatcher (D26).

Type Aliases§

NodeFn
A node fn: (&Ctx) -> () (R-fn-contract / D8). Single-thread (D22) ⇒ no Send bound. Stored as Rc so Dispatcher::invoke can clone it out of the pool and release the pool borrow before calling it — a fn that re-drives a downstream node (nested invoke) must not find the pool already borrowed.