Supervisor Tree
Language: 中文
Declaration Model
SupervisorSpec describes one supervisor node. It contains:
path— stable path for this supervisorstrategy— restart scope strategy (OneForOne,OneForAll,RestForOne)children— child specifications in declaration orderconfig_version— configuration version that produced this specdefault_restart_policy,default_backoff_policy,default_health_policy,default_shutdown_policy— policies inherited by children that do not overridesupervisor_failure_limit— maximum supervisor failures before parent escalationrestart_limit— optional supervisor-level restart limitescalation_policy— optional supervisor-level escalation policygroup_strategies— group-level strategy overridesgroup_configs— group-level restart budget, membership, and isolation configsgroup_dependencies— cross-group dependency edges for fault propagationseverity_defaults— default severity class per task role for escalation bifurcationchild_strategy_overrides— per-child strategy and governance overridesdynamic_supervisor_policy— runtime add_child acceptance policycontrol_channel_capacity— mpsc command channel capacityevent_channel_capacity— broadcast event channel capacity
ChildSpec describes one child. It contains:
id,name,kind— stable identity and task kindfactory— optionalArc<dyn TaskFactory>for worker childrenrestart_policy,shutdown_policy,health_policy,readiness_policy,backoff_policy— per-child policy overridesdependencies— child IDs that must become ready before this child startstags— low-cardinality grouping labelscriticality—CriticalorOptionaltask_role— optionalTaskRolethat selects default lifecycle policy semanticssidecar_config— optional sidecar binding (required when role isSidecar)severity— optional explicit severity overridegroup— optional group name for group-level isolation and budget trackinghealth_check,readiness— optional health/readiness check configurationsresource_limits— optional resource limitscommand_permissions— command permissions granted to this childenvironment,secrets— environment variables and secret references
Tree Building
SupervisorTree::build validates SupervisorSpec and converts children into path-aware nodes. Each child path is derived from the parent path and ChildId.
SupervisorPath::root returns the root path. SupervisorPath::join appends a child path segment. SupervisorPath::parent returns the parent path when it exists.
Startup And Shutdown Order
startup_order returns nodes in declaration order. shutdown_order returns nodes in reverse declaration order. This ordering is the basis for Shutdown Without Orphaned Tasks.
Restart Planning
restart_execution_plan resolves the runtime restart scope from the tree and SupervisorSpec. It keeps per-child overrides, group strategies, restart limits, escalation policies, and dynamic supervisor policy in one plan so the runtime control loop does not duplicate strategy selection logic.
Registry
RegistryStore stores ChildRuntime values by child identifier, supervisor path, and declaration order. Runtime control and current state queries should go through the registry instead of bypassing it.