pub struct SupervisorSpec {Show 28 fields
pub path: SupervisorPath,
pub strategy: SupervisionStrategy,
pub children: Vec<ChildSpec>,
pub config_version: String,
pub default_restart_policy: RestartPolicy,
pub default_backoff_policy: BackoffPolicy,
pub default_health_policy: HealthPolicy,
pub tree_shutdown: TreeShutdownPolicy,
pub supervisor_failure_limit: u32,
pub restart_limit: Option<RestartLimit>,
pub escalation_policy: Option<EscalationPolicy>,
pub group_strategies: Vec<GroupStrategy>,
pub group_configs: Vec<GroupConfig>,
pub group_dependencies: Vec<GroupDependencyEdge>,
pub severity_defaults: HashMap<TaskRole, SeverityClass>,
pub child_strategy_overrides: Vec<ChildStrategyOverride>,
pub dynamic_supervisor_policy: DynamicSupervisorPolicy,
pub control_channel_capacity: usize,
pub event_channel_capacity: usize,
pub backpressure_config: BackpressureConfig,
pub meltdown_policy: MeltdownPolicy,
pub failure_window_config: FailureWindowConfig,
pub restart_budget_config: RestartBudgetConfig,
pub pipeline_journal_capacity: usize,
pub pipeline_subscriber_capacity: usize,
pub concurrent_restart_limit: u32,
pub metrics_enabled: bool,
pub audit_enabled: bool,
}Expand description
Declarative specification for one supervisor node.
Fields§
§path: SupervisorPathPath for this supervisor.
strategy: SupervisionStrategyRestart scope strategy for child exits.
children: Vec<ChildSpec>Children in declaration order.
config_version: StringConfiguration version that produced this declaration.
default_restart_policy: RestartPolicyRestart policy inherited by children that do not override it.
default_backoff_policy: BackoffPolicyBackoff policy inherited by children that do not override it.
default_health_policy: HealthPolicyHealth policy inherited by children that do not override it.
tree_shutdown: TreeShutdownPolicyTree shutdown policy for this supervisor and default child budgets.
supervisor_failure_limit: u32Maximum supervisor failures before the supervisor-level escalation path is selected.
restart_limit: Option<RestartLimit>Optional supervisor-level restart limit.
escalation_policy: Option<EscalationPolicy>Optional fallback escalation policy for execution plans that do not define a child-level or group-level policy.
Root supervisors do not have a parent supervisor at runtime. When this
field is set on a root supervisor, EscalateToParent should be treated
as a configured policy label for planning and diagnostics, not as proof
that a parent supervisor exists.
group_strategies: Vec<GroupStrategy>Group-level strategy overrides.
group_configs: Vec<GroupConfig>Group-level configurations for restart budget, membership, and isolation.
group_dependencies: Vec<GroupDependencyEdge>Cross-group dependency edges for fault propagation.
severity_defaults: HashMap<TaskRole, SeverityClass>Default severity class per task role for escalation bifurcation (US3).
child_strategy_overrides: Vec<ChildStrategyOverride>Child-level strategy overrides.
dynamic_supervisor_policy: DynamicSupervisorPolicyRuntime policy for dynamic child additions.
control_channel_capacity: usizeControl command channel capacity.
Runtime capacity for queued supervisor control commands.
Recommended default: RECOMMENDED_CHANNEL_CAPACITY.
event_channel_capacity: usizeEvent broadcast channel capacity.
Runtime capacity for supervisor event broadcast delivery.
Recommended default: RECOMMENDED_CHANNEL_CAPACITY.
backpressure_config: BackpressureConfigBackpressure policy used by observability event subscribers.
meltdown_policy: MeltdownPolicyFailure fuse policy used by the supervision pipeline.
failure_window_config: FailureWindowConfigFailure accumulation window used by the supervision pipeline.
restart_budget_config: RestartBudgetConfigRestart budget used by the supervision pipeline.
pipeline_journal_capacity: usizeEvent journal capacity used by the supervision pipeline.
pipeline_subscriber_capacity: usizeSubscriber queue capacity used by the supervision pipeline.
concurrent_restart_limit: u32Maximum concurrent restarts allowed for this supervisor instance.
metrics_enabled: boolWhether metrics recording is enabled.
audit_enabled: boolWhether audit event recording is enabled.
Implementations§
Source§impl SupervisorSpec
impl SupervisorSpec
Sourcepub fn root(children: Vec<ChildSpec>) -> Self
pub fn root(children: Vec<ChildSpec>) -> Self
Creates a root supervisor specification.
§Arguments
children: Children declared under the root supervisor.
§Returns
Returns a root SupervisorSpec with declaration-order children.
§Examples
let spec = rust_supervisor::spec::supervisor::SupervisorSpec::root(Vec::new());
assert_eq!(spec.path.to_string(), "/");Sourcepub fn propagate_tree_shutdown_budget(&mut self)
pub fn propagate_tree_shutdown_budget(&mut self)
Copies the tree shutdown budget into every declared child.
Call this after changing Self::tree_shutdown when children should
inherit the updated cooperative stop windows.
§Arguments
This function has no arguments.
§Returns
This function does not return a value.
Sourcepub fn shutdown_budget_for(&self, child_id: &ChildId) -> ShutdownBudget
pub fn shutdown_budget_for(&self, child_id: &ChildId) -> ShutdownBudget
Trait Implementations§
Source§impl Clone for SupervisorSpec
impl Clone for SupervisorSpec
Source§fn clone(&self) -> SupervisorSpec
fn clone(&self) -> SupervisorSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SupervisorSpec
impl !UnwindSafe for SupervisorSpec
impl Freeze for SupervisorSpec
impl Send for SupervisorSpec
impl Sync for SupervisorSpec
impl Unpin for SupervisorSpec
impl UnsafeUnpin for SupervisorSpec
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);