pub enum RestartStrategy {
OneForOne,
OneForAll,
RestForOne,
SimpleOneForOne,
}Expand description
One of the four canonical Erlang/OTP restart strategies.
The strategy decides what happens to sibling children when one
child dies. Per-child behaviour is governed by RestartPolicy.
Variants§
OneForOne
On child failure, restart only that child. Default; matches most “tree of independent workers” use cases.
OneForAll
On child failure, restart every child. Used when children share state and must be in sync.
RestForOne
On child failure, restart the failed child and every child started after it (preserving startup order). Used when later children depend on earlier ones.
SimpleOneForOne
Dynamic children of the same shape, started on demand. The supervisor doesn’t know its children at boot; they’re added as they’re needed (e.g. one child per session).
Implementations§
Source§impl RestartStrategy
impl RestartStrategy
Sourcepub const fn discriminant(&self) -> &'static str
pub const fn discriminant(&self) -> &'static str
Stable variant discriminant — auto-generated by
#[derive(Discriminant)]. The string IS the wire
identifier for metrics labels / audit-log tags /
rate-limit keys; renaming an existing variant is a
breaking change.
Source§impl RestartStrategy
impl RestartStrategy
pub const fn is_one_for_one(&self) -> bool
pub const fn is_one_for_all(&self) -> bool
pub const fn is_rest_for_one(&self) -> bool
pub const fn is_simple_one_for_one(&self) -> bool
Source§impl RestartStrategy
impl RestartStrategy
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
Exhaustive iteration surface for every consumer that walks the
closed four-arm RestartStrategy discriminator set (the future
M4 mesh.pleme.io/v1alpha1/Supervisor CR materializer’s
admission-webhook rejection body naming the accepted-:estrategia
list, a future feira supervisor --estrategia … CLI arg-parse’s
“did you mean” hint via a Self::from_wire-scan over the slice,
the future feira app graph per-supervisor :estrategia column,
any future round-trip fuzz harness that sweeps every arm). A
future arm addition (an OTP-rest_for_all arm the theory
ABSORPTION-ROADMAP
might reach for once the four canonical OTP strategies stop
covering the substrate’s discovered load-shape) extends this
slice as one edit and every consumer picks up the new entry by
construction; the compiler-checked exhaustiveness on the sibling
method match arms (Self::as_str / Self::from_wire) is
the build-time guarantee that no arm forgets to grow.
Peer of the sibling closed-set typed enums’
crate::CaixaKind::ALL (6b1f4fb) /
crate::aplicacao::PlacementStrategy::ALL (18c7342) /
crate::aplicacao::RateLimitUnit::ALL (6bce03d) /
crate::dep::DepList::ALL (45ee563) exhaustive-iteration
surfaces — the fifth (and the first M2 OTP-shape) closed-set
typed enum on the caixa surface to converge onto the same
one-canonical-arm-list-per-enum discipline.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Canonical PascalCase discriminator scalar this variant serializes
as under crate::render::SUPERVISOR_KEY_ESTRATEGIA. The four arms
return the paired crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ONE
/ crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ALL /
crate::render::SUPERVISOR_ESTRATEGIA_REST_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_SIMPLE_ONE_FOR_ONE lifted
constants so every substrate consumer that dispatches on the
per-supervisor sibling-restart strategy (the future
wasm-operator’s per-supervisor sibling-restart branch, the future
M4 mesh.pleme.io/v1alpha1/Supervisor CR materializer’s
admission-time enum-arm bind, the caixa-operator’s hierarchical
reconciliation scheduler’s per-strategy fan-out) reads the same
byte-string the Serialize derive emits — the pin test in
[tests::restart_strategy_variants_serialize_to_lifted_scalar_values]
asserts the two paths agree, peer of the M3
PlacementStrategy::as_str (cc8f749) on the sibling per-Aplicacao
distribution-strategy axis.
Sourcepub fn from_wire(s: &str) -> Option<Self>
pub fn from_wire(s: &str) -> Option<Self>
Substrate-canonical reverse projection on the :supervisor :estrategia closed-set axis — parses the PascalCase
discriminator scalar back to the typed variant, or None when
s is outside
the closed-set arm-string set Self::as_str emits. Dispatches
on the same lifted
crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ALL /
crate::render::SUPERVISOR_ESTRATEGIA_REST_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_SIMPLE_ONE_FOR_ONE
constants the Self::as_str emitter walks, so the parse and
emit halves of the round-trip migrate through one caixa-core
edit on any future arm addition.
Prior to this lift the substrate carried only the forward
Self → &str projection on the OTP sibling-restart axis (the
Self::as_str emitter, the std::fmt::Display impl routed
through it, the Serialize derive that emits the same
byte-string under crate::render::SUPERVISOR_KEY_ESTRATEGIA)
plus the kebab-case dispatcher-catalog identity via
Self::discriminant — every non-serde consumer that wanted to
parse a wire-form PascalCase strategy scalar had to re-inline
a four-arm match s { "OneForOne" => …, "OneForAll" => …, "RestForOne" => …, "SimpleOneForOne" => …, _ => … } cascade
that expressed no compile-time link back to the typed variant’s
canonical lifted constant. A future variant rename or per-arm
serde-attribute drift would silently split the wire byte-string
one non-serde consumer parsed from the one the emitter wrote,
with the failure surfacing at parse time far from the rebrand
commit.
Distinct axis from the std::str::FromStr impl the
gen_platform::FromStrKind derive already installs on this
enum by design, not by drift: FromStr parses the kebab-case
dispatcher-catalog identity ("one-for-one" / "one-for-all" /
"rest-for-one" / "simple-one-for-one" — the inverse of
Self::discriminant), while this method inverts the
PascalCase wire byte-string Self::as_str emits. The
two-axis split lets the dispatcher-catalog identity live in
kebab-case
(where every peer catalog identifier already lives) without
forcing a wire-format rename on the tatara-lisp author surface
(:estrategia OneForOne, PascalCase) — the same two-axis
distinction the sibling crate::CaixaKind::from_wire (2aa6d23)
/ crate::aplicacao::PlacementStrategy::from_wire (18c7342)
carry on their peer closed-set typed-enum wire round-trips.
Same closed-set-reverse-projection discipline the sibling
crate::CaixaKind::from_wire (2aa6d23) /
crate::aplicacao::PlacementStrategy::from_wire (18c7342) /
crate::aplicacao::RateLimitUnit::from_suffix typed enums
carry on the peer wire-side str → Self axes — extended onto
the M2 OTP-shape sibling-restart-strategy closed-set axis, the
fifth substrate-side closed-set typed enum to converge on the
two-way str ↔ Self round-trip. Method-named from_wire (not
from_str) to match the peer crate::CaixaKind::from_wire
shape verbatim and side-step the std::str::FromStr impl the
derive already installs on the sibling kebab-case axis. Returns
Option<Self> (rather than Result<Self, _>) to match the peer
shapes: the caller picks the diagnostic form appropriate for
its use site.
Trait Implementations§
Source§impl AsRef<str> for RestartStrategy
Substrate-canonical AsRef<str> projection on the M2
per-supervisor sibling-restart RestartStrategy closed-set typed
enum — routes through the same RestartStrategy::as_str
pub const fn scalar accessor the paired std::fmt::Display
impl and the un-renamed serde::Serialize derive already key
off, so any future consumer that binds a RestartStrategy
through the standard-library impl AsRef<str> bound (a future
[caixa-feira] feira supervisor --estrategia <arm> verb that
composes the emitted PascalCase wire scalar into a
std::process::Command::arg shell-out of the future
wasm-operator’s admission gate, a per-supervisor structured-log
recorder on the future caixa-operator’s hierarchical
reconciliation surface that accepts impl AsRef<str> at the
tracing::field::Value Str-arm, a std::collections::HashMap
lookup keyed on the estrategia wire byte through
map.get::<str>(strategy.as_ref()) on a future per-strategy
dispatch table) reaches the paired crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ONE
/ crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ALL /
crate::render::SUPERVISOR_ESTRATEGIA_REST_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_SIMPLE_ONE_FOR_ONE
lifted-const through one substrate-primitive dispatch rather
than an open-coded .as_str() projection at every wire-up.
impl AsRef<str> for RestartStrategy
Substrate-canonical AsRef<str> projection on the M2
per-supervisor sibling-restart RestartStrategy closed-set typed
enum — routes through the same RestartStrategy::as_str
pub const fn scalar accessor the paired std::fmt::Display
impl and the un-renamed serde::Serialize derive already key
off, so any future consumer that binds a RestartStrategy
through the standard-library impl AsRef<str> bound (a future
[caixa-feira] feira supervisor --estrategia <arm> verb that
composes the emitted PascalCase wire scalar into a
std::process::Command::arg shell-out of the future
wasm-operator’s admission gate, a per-supervisor structured-log
recorder on the future caixa-operator’s hierarchical
reconciliation surface that accepts impl AsRef<str> at the
tracing::field::Value Str-arm, a std::collections::HashMap
lookup keyed on the estrategia wire byte through
map.get::<str>(strategy.as_ref()) on a future per-strategy
dispatch table) reaches the paired crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ONE
/ crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ALL /
crate::render::SUPERVISOR_ESTRATEGIA_REST_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_SIMPLE_ONE_FOR_ONE
lifted-const through one substrate-primitive dispatch rather
than an open-coded .as_str() projection at every wire-up.
Peer of the sibling std::fmt::Display impl on the same
primitive — both delegate to the shared
RestartStrategy::as_str pub const fn accessor, so
[format!("{s}")], s.as_str(), and
<RestartStrategy as AsRef<str>>::as_ref(&s) resolve to the same
byte-string per instance by construction. A future variant rename
or #[serde(rename_all = "kebab-case")] attribute-drift on the
enum reaches every one of the three paths (plus the wire-format
Serialize derive that already routes through the same lifted
const) through exactly one caixa-core edit.
Same “route the trait impl through the substrate-primitive
accessor” discipline the sibling crate::CaixaVersion
AsRef<str> impl (16d5c7e) carries on the paired top-level
:versao typed newtype — extends it onto the second AsRef<str>
axis on the caixa typed surface (the first M2 OTP-shape
closed-set typed enum to converge onto the standard-library
AsRef<str> projection). Rust-side newtype/typed-enum
convention pairs AsRef<str> and [fmt::Display] on the same
primitive so a caller who has one has both; before this lift,
RestartStrategy carried [fmt::Display] but not the paired
AsRef<str> impl the convention names.
Pinned load-bearing by
[tests::restart_strategy_as_ref_str_routes_through_as_str_accessor]
(byte-parity pin against RestartStrategy::as_str across the
four-arm closed set) — any future silent detour that routes the
impl through a divergent projection (a per-arm inline
match self { … } re-inlining that opens a compile-time link to
the un-lifted arm-literal, a swap onto the kebab-case
gen_platform::Discriminant catalog identity that would collide
the wire axis with the dispatcher-catalog axis) trips at
caixa-core test time under assert_eq! rather than at a
downstream impl AsRef<str>-bound consumer’s silent split.
Source§impl Clone for RestartStrategy
impl Clone for RestartStrategy
Source§fn clone(&self) -> RestartStrategy
fn clone(&self) -> RestartStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RestartStrategy
Source§impl Debug for RestartStrategy
impl Debug for RestartStrategy
Source§impl Default for RestartStrategy
impl Default for RestartStrategy
Source§impl<'de> Deserialize<'de> for RestartStrategy
impl<'de> Deserialize<'de> for RestartStrategy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RestartStrategy
std::fmt::Display routed through RestartStrategy::as_str, so the
pretty-printed byte-string every consumer that formats the strategy as
user-facing text lands on (the future wasm-operator’s per-supervisor
sibling-restart-strategy diagnostic line, the future feira app graph
per-supervisor strategy line, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s admission-webhook
rejection body) reaches for the same lifted
crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ALL /
crate::render::SUPERVISOR_ESTRATEGIA_REST_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_SIMPLE_ONE_FOR_ONE const the
wire-format Serialize derive already emits under
crate::render::SUPERVISOR_KEY_ESTRATEGIA and the
RestartStrategy::as_str helper already returns.
impl Display for RestartStrategy
std::fmt::Display routed through RestartStrategy::as_str, so the
pretty-printed byte-string every consumer that formats the strategy as
user-facing text lands on (the future wasm-operator’s per-supervisor
sibling-restart-strategy diagnostic line, the future feira app graph
per-supervisor strategy line, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s admission-webhook
rejection body) reaches for the same lifted
crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_ONE_FOR_ALL /
crate::render::SUPERVISOR_ESTRATEGIA_REST_FOR_ONE /
crate::render::SUPERVISOR_ESTRATEGIA_SIMPLE_ONE_FOR_ONE const the
wire-format Serialize derive already emits under
crate::render::SUPERVISOR_KEY_ESTRATEGIA and the
RestartStrategy::as_str helper already returns.
Pre-convergence the two paths structurally disagreed — the
#[derive(gen_platform::Discriminant)] + #[discriminant(also_display)]
route (now retired here) sent std::fmt::Display through the
gen-platform discriminant catalog string, which arrives kebab-case as
"one-for-one" / "one-for-all" / "rest-for-one" /
"simple-one-for-one", while the wire format ran as PascalCase
"OneForOne" / "OneForAll" / "RestForOne" / "SimpleOneForOne"
through the un-renamed serde derive. Every consumer that formatted
the strategy for a diagnostic line, a graph, or a rejection body under
format!("{v}") therefore landed under a different byte-string than
the wire format the operator’s per-strategy dispatch keyed off — a
silent split whose apply-time symptom (a format!("{v}")-carrying
diagnostic quoting "one-for-one" while the wire scalar the operator
probed was "OneForOne") surfaced as a confused correlate at
operator-log time far from the two-declaration site.
Routing Display through RestartStrategy::as_str closes the third
path: every format!("{v}") call reaches the same lifted
[crate::render::SUPERVISOR_ESTRATEGIA_*] const the wire format and
the RestartStrategy::as_str helper route through — Debug (the
compiler-derived variant name), Display (via as_str), and Serialize
(via the un-renamed derive) all resolve to the same PascalCase
byte-string per variant. A future variant rename or
#[serde(rename_all = "kebab-case")] attribute reaches every path at
exactly one place, structurally.
The dispatcher-catalog identity remains kebab-case — Self::discriminant
(from #[derive(gen_platform::Discriminant)]) still returns
"one-for-one" / etc., and the fleet-wide
[gen_platform::register_dispatcher!("caixa.restart-strategy", …)]
registration keys the catalog off the same kebab identity. The two
naming worlds now live on separate typed methods (Display /
as_str for the wire byte-string, discriminant for the catalog
identity) rather than sharing one Display route that structurally
disagrees with the wire format.
Pin tests
[tests::restart_strategy_display_routes_through_as_str_helper]
and
[tests::restart_strategy_display_matches_serialized_wire_byte_string]
assert the three paths agree byte-for-byte on every variant, so a
future variant rename or per-arm serde attribute drift is a build
error visible at caixa-core test time, not a silent per-consumer
dispatch miss at apply / reconcile time.
Mirrors the M3 crate::aplicacao::PlacementStrategy Display impl
(aplicacao.rs:2306) on the sibling per-Aplicacao distribution-strategy
axis — same three-path-convergence discipline, extended to close the
second of three OTP-shaped closed-enum discriminator axes on the
caixa typed surface.
impl Eq for RestartStrategy
Source§impl FromStr for RestartStrategy
impl FromStr for RestartStrategy
Source§impl Hash for RestartStrategy
impl Hash for RestartStrategy
Source§impl PartialEq for RestartStrategy
impl PartialEq for RestartStrategy
Source§impl Serialize for RestartStrategy
impl Serialize for RestartStrategy
impl StructuralPartialEq for RestartStrategy
Source§impl TypedDispatcher for RestartStrategy
impl TypedDispatcher for RestartStrategy
Source§fn variant_kinds() -> Vec<&'static str>
fn variant_kinds() -> Vec<&'static str>
Source§fn variant_fields() -> Vec<(&'static str, Vec<&'static str>)>
fn variant_fields() -> Vec<(&'static str, Vec<&'static str>)>
inherit (variant) <fields> Nix patterns.Source§fn variant_count() -> usize
fn variant_count() -> usize
Auto Trait Implementations§
impl Freeze for RestartStrategy
impl RefUnwindSafe for RestartStrategy
impl Send for RestartStrategy
impl Sync for RestartStrategy
impl Unpin for RestartStrategy
impl UnsafeUnpin for RestartStrategy
impl UnwindSafe for RestartStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.