Skip to main content

Module trigger

Module trigger 

Source
Expand description

The trigger: the durable record that demand for work exists.

A trigger is what makes the dispatcher pick a ticket up. This module owns the pure half of the concept: its kinds, its states, whether one is due, the arithmetic that rearms a recurring one, and the transition every write is derived from. Storage lives behind the coordination boundary in work_state::trigger; nothing here reads a clock, a database, or a file.

Structs§

Trigger
A trigger’s schedulable state: everything due-ness and step need, and nothing about which ticket or project the demand points at. Targeting is a storage-side join; whether the demand is live is a decision.

Enums§

Effect
What a transition asks storage to persist. One variant per named write in work_state::trigger; there is no effect for “leave it alone”, so an empty result means the event was a no-op.
Event
What happened to a trigger. Events are evidence the daemon observed, never an intent to write a particular row.
Fault
A trigger whose own fields contradict its kind. Faults are data problems, not race outcomes, so they surface as corruption rather than denial.
TriggerKind
What kind of demand a trigger records. The kind is also what decides how the trigger becomes due and what firing it does next.
TriggerState
A trigger’s lifecycle state. queued is demand not yet met; the other two are terminal and never dispatch.

Functions§

rearm_every_at
The next instant a recurring trigger becomes due, given the instant it was due and its cadence.
step
The trigger transition. trigger is advanced in place and the returned effects are what storage must persist, in order.