StatifierBlocks.Core.Wait (StatifierBlocks v0.1.0)

Copy Markdown View Source

core.wait: a leaf whose whole meaning is its config (ADR-0002 decision 10).

No slots, one :duration field. The duration is an ISO-8601 duration string rather than a number of seconds because ADR-0001 decision 6 forbids floats in config, and a bare integer would have to carry its unit somewhere else. "PT30S", "PT48H", "P1D" - integer components only, for the same reason.

This type validates the string; it does not resolve it to a number of milliseconds, mint a timer, or know that durable timers exist. Turning it into a delayed send is the compiler's job.

Summary

Functions

A compound state that sends itself a delayed event on entry and finishes when that event arrives.

A wait constrains nothing and is constrained by nothing beyond being a step: it declares kinds and leaves consumes and produces to ADR-0003 decision 5's permissive default, since waiting transforms no data.

Functions

emit(block, context)

A compound state that sends itself a delayed event on entry and finishes when that event arrives.

<state id="s_WAI" initial="s_WAI__waiting">
  <state id="s_WAI__waiting">
    <onentry><send delay="48h" event="statifier_blocks.wait.blk_WAI" id="s_WAI__timer"/></onentry>
    <transition event="statifier_blocks.wait.blk_WAI" target="s_WAI__done"/>
  </state>
  <final id="s_WAI__done"/>
</state>

The event name carries the block id, so two waits in the same chart never wake each other. <send> names no target, which under spec 6.2.2 is the running session's own external queue - and a delayed send on that queue is exactly what statifier_oban turns into a durable timer. This type still does not know durable timers exist; it emits an ordinary delayed send and the host's session decides what backs it.

The duration translation is component-wise and lossless

ADR-0001 decision 6 forbids floats in config, so duration is an ISO-8601 duration with integer components only. Statifier resolves a delay attribute through Statifier.Duration, which delegates to Predicator.Duration.parse/1 and recognizes y, mo, w, d, h, m, s and ms - a strict superset of the SCXML schema's five units. Every ISO component therefore has an exact counterpart, and the translation is a rename rather than an arithmetic conversion:

ISOdelay
P1Y1y
P1M (before T)1mo
P1W / P1D1w / 1d
PT1H / PT1M / PT1S1h / 1m / 1s

Nothing here decides how many days a month is, because nothing here has to: the ambiguity stays where the author wrote it and is resolved by the one duration vocabulary the platform shares.

io(config)

A wait constrains nothing and is constrained by nothing beyond being a step: it declares kinds and leaves consumes and produces to ADR-0003 decision 5's permissive default, since waiting transforms no data.