Skip to main content

Module engine

Module engine 

Source
Expand description

The dynamic scheduler: token-based activation over BSP supersteps.

Edge evaluation emits tokens onto edges; a node joins the next frontier when its Activation policy is satisfiable from pending (unconsumed) tokens, and activation consumes them. This is process-network/Kahn-style firing, and it makes loops fall out naturally: a back-edge simply delivers another token to an earlier node, which refires. There is no “executed once” set and no special loop construct.

§Circuit breakers

Loops make runaway execution possible by construction, so bounds are part of the core:

§Joins inside loops are almost always Any or merger-joins

An All-join on a cycle is the classic self-deadlock — one predecessor’s token arrives once per iteration, the other’s arrives once ever, so the join waits forever and the run ends in BspError::Deadlock:

       entry ──▶ J (All) ──▶ body
                   ▲            │
                   └────────────┘   J needs a token on BOTH edges per firing,
                     back-edge      but entry only ever fires once → stall

Validation warns on this shape; write the loop join as Any (or a merger-join).

Structs§

BspEngine
The dynamic scheduler that organizes nodes into supersteps and executes them concurrently (bounded), re-executing nodes as loops deliver new activation tokens.
ValidationReport
The result of graph validation: fatal errors plus non-fatal findings.

Constants§

DEFAULT_MAX_PENDING_TOKENS
The default cap on pending (unconsumed) tokens per edge (token-flood guard).
DEFAULT_MAX_STEPS
The default global superstep budget (circuit breaker). The pre-rewrite engine had no cap; loops make one mandatory, so a generous default is baked in — tune it with BspEngine::with_max_steps.

Type Aliases§

BranchTransform
A transform applied to each branch-state clone at multi-node frontier formation, right after the clone is taken from the trunk (see BspEngine::with_branch_transform). The usize is the branch’s ordinal within the frontier formation (declaration order, 0-based).