Expand description
OTP-shaped supervisor trees, encoded as a typed :kind Supervisor
caixa with a strategy + restart-policy children list.
See theory/INSPIRATIONS.md §II.2 + §III.2 for the prior-art frame
(Erlang OTP supervisor + Lunatic supervisor strategies as Rust types).
(defcaixa
:nome "my-app-root"
:versao "0.1.0"
:kind Supervisor
:estrategia OneForOne
:max-restarts 5
:restart-window "60s"
:children ((:caixa "worker" :versao "^0.1" :restart Permanent)
(:caixa "cache-server" :versao "^0.1" :restart Transient)
(:caixa "scratch-job" :versao "^0.1" :restart Temporary)))wasm-operator (M3) walks the tree, materializes one ComputeUnit per child, and applies the strategy on child failure. The Rust types here are the typed contract; the runtime owns lifecycle.
Modules§
- duration_
codec - Shared duration string codec for the typed slots that take a
duration (
restart_window,MeshPolicy::timeout,CircuitBreaker::window, …). Public socrate::aplicacaocan reuse it without duplicating the parser. - duration_
codec_ required - Required-Duration variant for fields that aren’t Option
.
Structs§
- Child
Spec - One child entry in the supervisor’s
:childrenlist. - Restart
Policy Parse Error - Auto-generated parse error for the matching
FromStrKindimpl. - Restart
Strategy Parse Error - Auto-generated parse error for the matching
FromStrKindimpl. - Supervisor
Spec - Supervisor-typed slots that live alongside the standard Caixa
fields when
:kind Supervisor. Held flat incrate::Caixaso the manifest stays a single typed form; this struct exists for validation + conversion.
Enums§
- Restart
Policy - Per-child restart policy.
- Restart
Strategy - One of the four canonical Erlang/OTP restart strategies.
- Supervisor
Error
Constants§
- SUPERVISOR_
CHILD_ RESTART_ DEFAULT - Substrate-canonical Erlang/OTP-shaped per-child restart-decision-policy
default for the
:children :restartaxis — the OTPpermanentworker-child default ({ChildId, StartFunc, permanent, …}in asupervisor’sinit/1child-spec tuple), extracted as a typedpub constso every substrate-side consumer that resolves “whatChildSpec::restartvariant does an author-omitted:children :restartslot degrade onto?” reaches for exactly one substrate- primitiveRestartPolicy. - SUPERVISOR_
ESTRATEGIA_ DEFAULT - Substrate-canonical Erlang/OTP-shaped sibling-restart-strategy default
for the
:supervisor :estrategiaaxis — the canonicalone_for_onehalf of Learn You Some Erlang’s{one_for_one, intensity, 5, 60}worker-supervisor default, extracted as a typedpub constso every substrate-side consumer that resolves “whatSupervisorSpec::estrategiavariant does an author-omitted:estrategiaslot degrade onto?” reaches for exactly one substrate- primitiveRestartStrategy. - SUPERVISOR_
MAX_ RESTARTS_ DEFAULT - Substrate-canonical Erlang/OTP-shaped
MaxIntensityrestart-budget- count default for the:supervisor :max-restartsaxis — the canonical{intensity, 5, 60}MaxIntensityhalf of Learn You Some Erlang’s worker-supervisor default, extracted as a typedpub constso every substrate-side consumer that resolves “whatSupervisorSpec::max_restartsvalue does an author-omitted:max-restartsslot degrade onto?” reaches for exactly one substrate-primitiveu32. - SUPERVISOR_
MAX_ RESTARTS_ MAX - Upper-bound ceiling on the
:supervisor :max-restartsaxis — every validatedSupervisorSpec::max_restartspastSupervisorSpec::validatelies in1..=SUPERVISOR_MAX_RESTARTS_MAX. - SUPERVISOR_
RESTART_ WINDOW_ DEFAULT - Substrate-canonical Erlang/OTP-shaped
Periodsliding-window-duration default for the:supervisor :restart-windowaxis — the canonical{intensity, 5, 60}Periodhalf of Learn You Some Erlang’s worker-supervisor default, extracted as a typedpub constso every substrate-side consumer that resolves “whatSupervisorSpec::restart_windowvalue does an author-omitted:restart-windowslot degrade onto?” reaches for exactly one substrate-primitiveDuration. - SUPERVISOR_
RESTART_ WINDOW_ MAX - Upper-bound ceiling on the
:supervisor :restart-windowaxis — every validatedSome(SupervisorSpec::restart_window)pastSupervisorSpec::validatelies in1ms..=SUPERVISOR_RESTART_WINDOW_MAX(inclusive on both ends, integer-millisecond magnitudes by the canonical-form gate immediately preceding).
Functions§
- validate_
no_ self_ supervision - Cross-slot coherence gate on the supervision tree: no
:children :caixaentry may name the supervisor’s own:nome.