Skip to main content

Module supervisor

Module supervisor 

Source
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 so crate::aplicacao can reuse it without duplicating the parser.
duration_codec_required
Required-Duration variant for fields that aren’t Option.

Structs§

ChildSpec
One child entry in the supervisor’s :children list.
RestartPolicyParseError
Auto-generated parse error for the matching FromStrKind impl.
RestartStrategyParseError
Auto-generated parse error for the matching FromStrKind impl.
SupervisorSpec
Supervisor-typed slots that live alongside the standard Caixa fields when :kind Supervisor. Held flat in crate::Caixa so the manifest stays a single typed form; this struct exists for validation + conversion.

Enums§

RestartPolicy
Per-child restart policy.
RestartStrategy
One of the four canonical Erlang/OTP restart strategies.
SupervisorError

Constants§

SUPERVISOR_MAX_RESTARTS_MAX
Upper-bound ceiling on the :supervisor :max-restarts axis — every validated SupervisorSpec::max_restarts past SupervisorSpec::validate lies in 1..=SUPERVISOR_MAX_RESTARTS_MAX.
SUPERVISOR_RESTART_WINDOW_MAX
Upper-bound ceiling on the :supervisor :restart-window axis — every validated Some(SupervisorSpec::restart_window) past SupervisorSpec::validate lies in 1ms..=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 :caixa entry may name the supervisor’s own :nome.