Skip to main content

Module trigger

Module trigger 

Source
Expand description

Triggers (plan piece 3 / Phase B) — the substrate of dependencies, branches, and DAGs.

A trigger is a condition that, once satisfied, fires an Action (submit / start a task). DAGs emerge from tasks arming triggers on each other — after_task is a dependency edge, if_result is a branch — with no DAG DSL, no controller loop, no engine. The TriggerEngine is a pure, indexed predicate evaluator: it is driven by events (a task changed status, the logical clock ticked), and a fired event touches only the triggers keyed to it — the plan’s O(relevant)-not-O(all) index (perf note).

Determinism is preserved exactly as in the fold: there is no now(). The clock is an explicit tick input and results are an explicit map, so the same event sequence fires the same triggers on replay.

Structs§

TriggerEngine
An indexed set of armed triggers. Driven by events: when a task changes status call Self::on_task_change; when the clock advances call Self::on_tick. Each evaluates only the triggers keyed to that event and returns the Actions of the satisfied ones, disarming them (fire-once).
TriggerWorld
The deterministic world a trigger evaluates against. No now(): the clock is the explicit tick, results are an explicit map.

Enums§

Action
What a fired trigger does. A DAG edge is, e.g., AfterTask(A) → Submit(B).
Trigger
A condition that, once satisfied, fires an Action.