pub enum RestartPolicy {
Permanent,
Temporary,
Transient,
}Expand description
Per-child restart policy.
Permanent / Temporary / Transient match Erlang/OTP semantics 1:1.
Variants§
Permanent
Always restart the child, regardless of how it died. Used for long-running services that must always be up.
Temporary
Never restart. Used for one-shot work whose completion is
itself the success signal (oneShot triggers map here).
Transient
Restart only when the child died abnormally (non-zero exit or unhandled exception). A clean exit completes the child.
Implementations§
Source§impl RestartPolicy
impl RestartPolicy
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 RestartPolicy
impl RestartPolicy
pub const fn is_permanent(&self) -> bool
pub const fn is_temporary(&self) -> bool
pub const fn is_transient(&self) -> bool
Source§impl RestartPolicy
impl RestartPolicy
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_CHILD_KEY_RESTART. The three
arms return the paired
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT lifted
constants so every substrate consumer that dispatches on the
per-child restart-decision policy (the future wasm-operator’s
per-child post-exit restart-decision 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-child-policy fan-out) reads the
same byte-string the Serialize derive emits — the pin test in
[tests::restart_policy_variants_serialize_to_lifted_scalar_values]
asserts the two paths agree, peer of the M2
RestartStrategy::as_str (09ffb2d) on the sibling per-supervisor
sibling-restart-strategy axis and the M3
crate::aplicacao::PlacementStrategy::as_str (cc8f749) on the
per-Aplicacao distribution-strategy axis — the third of three
OTP-shaped closed-enum discriminator axes on the caixa typed
surface to converge onto the same three-path-convergence
(Serialize derive → as_str helper → lifted constant)
drift-detection posture.
Trait Implementations§
Source§impl Clone for RestartPolicy
impl Clone for RestartPolicy
Source§fn clone(&self) -> RestartPolicy
fn clone(&self) -> RestartPolicy
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 RestartPolicy
Source§impl Debug for RestartPolicy
impl Debug for RestartPolicy
Source§impl Default for RestartPolicy
impl Default for RestartPolicy
Source§impl<'de> Deserialize<'de> for RestartPolicy
impl<'de> Deserialize<'de> for RestartPolicy
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 RestartPolicy
std::fmt::Display routed through RestartPolicy::as_str, so the
pretty-printed byte-string every consumer that formats the policy as
user-facing text lands on (the future wasm-operator’s per-child
post-exit restart-decision diagnostic line, the future feira app graph per-child restart column, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s per-child
admission-webhook rejection body) reaches for the same lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
wire-format Serialize derive already emits under
crate::render::SUPERVISOR_CHILD_KEY_RESTART and the
RestartPolicy::as_str helper already returns.
impl Display for RestartPolicy
std::fmt::Display routed through RestartPolicy::as_str, so the
pretty-printed byte-string every consumer that formats the policy as
user-facing text lands on (the future wasm-operator’s per-child
post-exit restart-decision diagnostic line, the future feira app graph per-child restart column, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s per-child
admission-webhook rejection body) reaches for the same lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
wire-format Serialize derive already emits under
crate::render::SUPERVISOR_CHILD_KEY_RESTART and the
RestartPolicy::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
"permanent" / "temporary" / "transient" on this three-arm enum
(whose variant names each collapse to their own lowercase form under
the kebab-case transform), while the wire format ran as PascalCase
"Permanent" / "Temporary" / "Transient" through the un-renamed
serde derive. Every consumer that formatted the policy for a
diagnostic line, a graph column, or a rejection body under
format!("{v}") therefore landed under a different byte-string than
the wire format the operator’s per-child-policy dispatch keyed off —
a silent split whose apply-time symptom (a format!("{v}")-carrying
diagnostic quoting "permanent" while the wire scalar the operator
probed was "Permanent") surfaced as a confused correlate at
operator-log time far from the two-declaration site.
Routing Display through RestartPolicy::as_str closes the third
path: every format!("{v}") call reaches the same lifted
[crate::render::SUPERVISOR_CHILD_RESTART_*] const the wire format
and the RestartPolicy::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
"permanent" / "temporary" / "transient", and the fleet-wide
[gen_platform::register_dispatcher!("caixa.restart-policy", …)]
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_policy_display_routes_through_as_str_helper]
and
[tests::restart_policy_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 per-Aplicacao distribution-strategy axis
and the sibling RestartStrategy Display impl on the
per-supervisor sibling-restart-strategy axis — same three-path-
convergence discipline, extended to close the third and final of
three OTP-shaped closed-enum discriminator axes on the caixa typed
surface.
impl Eq for RestartPolicy
Source§impl FromStr for RestartPolicy
impl FromStr for RestartPolicy
Source§impl Hash for RestartPolicy
impl Hash for RestartPolicy
Source§impl PartialEq for RestartPolicy
impl PartialEq for RestartPolicy
Source§impl Serialize for RestartPolicy
impl Serialize for RestartPolicy
impl StructuralPartialEq for RestartPolicy
Source§impl TypedDispatcher for RestartPolicy
impl TypedDispatcher for RestartPolicy
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 RestartPolicy
impl RefUnwindSafe for RestartPolicy
impl Send for RestartPolicy
impl Sync for RestartPolicy
impl Unpin for RestartPolicy
impl UnsafeUnpin for RestartPolicy
impl UnwindSafe for RestartPolicy
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.