pub struct ConfigState {Show 16 fields
pub supervisor: SupervisorRootConfig,
pub policy: PolicyConfig,
pub shutdown: ShutdownConfig,
pub observability: ObservabilityConfig,
pub audit: AuditConfig,
pub backpressure: BackpressureConfig,
pub groups: Vec<GroupConfig>,
pub group_strategies: Vec<GroupStrategyConfig>,
pub group_dependencies: Vec<GroupDependencyConfig>,
pub child_strategy_overrides: Vec<ChildStrategyOverrideConfig>,
pub severity_defaults: Vec<SeverityDefaultConfig>,
pub dashboard: Option<DashboardIpcConfig>,
pub children: Vec<ChildSpec>,
pub spec_hash: String,
pub pending_additions: Vec<PendingChild>,
pub compensating_records: Vec<CompensatingRecord>,
}Expand description
Supervisor configuration state with add_child transaction support.
Fields§
§supervisor: SupervisorRootConfigRoot supervisor declaration values.
policy: PolicyConfigRuntime policy values.
shutdown: ShutdownConfigShutdown budget values.
observability: ObservabilityConfigObservability switches and capacities.
audit: AuditConfigCommand audit persistence configuration.
backpressure: BackpressureConfigBackpressure policy for observability event subscribers.
groups: Vec<GroupConfig>Group-level restart budgets and membership declarations.
group_strategies: Vec<GroupStrategyConfig>Group-level strategy overrides.
group_dependencies: Vec<GroupDependencyConfig>Cross-group failure propagation dependencies.
child_strategy_overrides: Vec<ChildStrategyOverrideConfig>Child-level strategy overrides.
severity_defaults: Vec<SeverityDefaultConfig>Default severity class per task role.
dashboard: Option<DashboardIpcConfig>Optional target-side dashboard IPC configuration.
children: Vec<ChildSpec>Validated child specifications loaded from YAML declarations.
spec_hash: StringSHA-256 hash of the SupervisorSpec for audit reconciliation.
pending_additions: Vec<PendingChild>Pending add_child transactions.
compensating_records: Vec<CompensatingRecord>Compensating records for recovery.
Implementations§
Source§impl ConfigState
impl ConfigState
Sourcepub fn begin_transaction(
&mut self,
declaration: ChildDeclaration,
) -> Result<Uuid, SupervisorError>
pub fn begin_transaction( &mut self, declaration: ChildDeclaration, ) -> Result<Uuid, SupervisorError>
Converts validated configuration into a supervisor declaration.
§Arguments
This function has no arguments.
§Returns
Returns a crate::spec::supervisor::SupervisorSpec derived from the
validated YAML configuration.
§Examples
Begins an add_child transaction by creating a PendingChild entry.
§Arguments
declaration: The child declaration to stage.
§Returns
Returns the generated transaction UUID on success.
§Errors
Returns an error if a transaction is already in progress.
Sourcepub fn commit_transaction(
&mut self,
transaction_id: Uuid,
) -> Result<(), SupervisorError>
pub fn commit_transaction( &mut self, transaction_id: Uuid, ) -> Result<(), SupervisorError>
Commits an add_child transaction, registering the child in the topology.
§Arguments
transaction_id: The transaction UUID to commit.
Sourcepub fn rollback_transaction(
&mut self,
transaction_id: Uuid,
error: String,
) -> Result<(), SupervisorError>
pub fn rollback_transaction( &mut self, transaction_id: Uuid, error: String, ) -> Result<(), SupervisorError>
Rolls back an add_child transaction, creating a compensating record.
§Arguments
transaction_id: The transaction UUID to roll back.error: Human-readable error description.
Sourcepub fn has_pending_transaction(&self) -> bool
pub fn has_pending_transaction(&self) -> bool
Returns true when a pending transaction exists.
Sourcepub fn recover_pending_transactions(&mut self)
pub fn recover_pending_transactions(&mut self)
Recovers pending transactions after a restart.
Iterates compensating records and reconciles them against the current spec state. Records with state “pending” that have a matching declaration hash are marked as committed.
Sourcepub fn to_supervisor_spec(&self) -> Result<SupervisorSpec, SupervisorError>
pub fn to_supervisor_spec(&self) -> Result<SupervisorSpec, SupervisorError>
let yaml = r#"
supervisor:
strategy: OneForAll
policy:
child_restart_limit: 10
child_restart_window_ms: 60000
supervisor_failure_limit: 30
supervisor_failure_window_ms: 60000
initial_backoff_ms: 10
max_backoff_ms: 1000
jitter_ratio: 0.0
heartbeat_interval_ms: 1000
stale_after_ms: 3000
shutdown:
graceful_timeout_ms: 1000
abort_wait_ms: 100
observability:
event_journal_capacity: 64
metrics_enabled: true
audit_enabled: true
"#;
let state = rust_supervisor::config::yaml::parse_config_state(yaml).unwrap();
let spec = state.to_supervisor_spec().unwrap();
assert_eq!(spec.strategy, rust_supervisor::spec::supervisor::SupervisionStrategy::OneForAll);
assert_eq!(spec.supervisor_failure_limit, 30);Trait Implementations§
Source§impl Clone for ConfigState
impl Clone for ConfigState
Source§fn clone(&self) -> ConfigState
fn clone(&self) -> ConfigState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConfigState
impl Debug for ConfigState
Source§impl<'de> Deserialize<'de> for ConfigState
impl<'de> Deserialize<'de> for ConfigState
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 PartialEq for ConfigState
Manual partial equality — skips children because ChildSpec contains
Arc<dyn TaskFactory> which does not implement PartialEq.
impl PartialEq for ConfigState
Manual partial equality — skips children because ChildSpec contains
Arc<dyn TaskFactory> which does not implement PartialEq.
Source§impl Serialize for ConfigState
impl Serialize for ConfigState
Source§impl TryFrom<SupervisorConfig> for ConfigState
impl TryFrom<SupervisorConfig> for ConfigState
Source§fn try_from(config: SupervisorConfig) -> Result<Self, Self::Error>
fn try_from(config: SupervisorConfig) -> Result<Self, Self::Error>
Converts a deserialized supervisor config into validated state.
Source§type Error = SupervisorError
type Error = SupervisorError
Auto Trait Implementations§
impl Freeze for ConfigState
impl !RefUnwindSafe for ConfigState
impl Send for ConfigState
impl Sync for ConfigState
impl Unpin for ConfigState
impl UnsafeUnpin for ConfigState
impl !UnwindSafe for ConfigState
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);