pub struct ServiceSupervisor { /* private fields */ }Implementations§
Source§impl ServiceSupervisor
impl ServiceSupervisor
pub fn start(config_path: &str) -> Result<Self, RuntimeError>
Sourcepub fn start_from_config(
rt_config: RuntimeConfig,
config_path: Option<String>,
) -> Result<Self, RuntimeError>
pub fn start_from_config( rt_config: RuntimeConfig, config_path: Option<String>, ) -> Result<Self, RuntimeError>
Start from an already-validated [RuntimeConfig] without reading a file.
When config_path is provided (file-backed startup), SIGHUP reload
is enabled. When None (in-memory/compatibility startup), SIGHUP
reload is disabled because there is no stable user-authored config
file to reload from.
Native startup passes no compatibility state (None).
Sourcepub fn start_from_config_with_compatibility(
rt_config: RuntimeConfig,
config_path: Option<String>,
hooks: CompatibilityRuntimeHooks,
) -> Result<Self, RuntimeError>
pub fn start_from_config_with_compatibility( rt_config: RuntimeConfig, config_path: Option<String>, hooks: CompatibilityRuntimeHooks, ) -> Result<Self, RuntimeError>
Start from an already-validated [RuntimeConfig] with explicit
compatibility runtime hooks.
Only the pproxy compatibility facades use this path, passing hooks
built via CompatibilityRuntimeHooks::from_facade. Native startup
uses start/start_from_config (no compatibility state).
Sourcepub fn start_from_config_with_options(
rt_config: RuntimeConfig,
config_path: Option<String>,
compatibility_options: CompatibilityOptions,
) -> Result<Self, RuntimeError>
👎Deprecated: use start_from_config_with_compatibility with CompatibilityRuntimeHooks
pub fn start_from_config_with_options( rt_config: RuntimeConfig, config_path: Option<String>, compatibility_options: CompatibilityOptions, ) -> Result<Self, RuntimeError>
use start_from_config_with_compatibility with CompatibilityRuntimeHooks
Legacy source-compatible startup shim.
Restored so pre-Phase-3 callers of
start_from_config_with_options(RuntimeConfig, Option<String>, CompatibilityOptions) keep compiling. Converts the legacy DTO via
CompatibilityRuntimeHooks::from_legacy_options and delegates to the
canonical Phase 3 startup path without duplicating supervisor
initialization:
start_from_config_with_options(... CompatibilityOptions)
-> legacy conversion
-> start_from_config_with_compatibility(... hooks)
-> startup::init_supervisor(... Some(hooks))A default legacy value preserves native-equivalent behavior by
delegating to start_from_config() (no fabricated hooks).
debug/verbose_level are accepted for source compatibility but do
not configure tracing; a single warning explains that logging policy
is facade-owned. New code should use
start_from_config_with_compatibility with
CompatibilityRuntimeHooks.
pub fn state(&self) -> &Arc<RuntimeState> ⓘ
pub fn shutdown_token(&self) -> CancellationToken
Sourcepub fn with_tls_client_config(self, config: Arc<ClientConfig>) -> Self
pub fn with_tls_client_config(self, config: Arc<ClientConfig>) -> Self
Override the TLS client config used for upstream connections (e.g., Trojan). Intended for test-only use (e.g., insecure TLS for self-signed certs).
Sourcepub fn reload_config(&mut self) -> ReloadResult
pub fn reload_config(&mut self) -> ReloadResult
Attempt to reload configuration. Encapsulates the full reload transaction:
- Load and compile new config
- Delegate to the canonical
RuntimeState::apply_compiled_configtransaction (classification, snapshot build, publish, routing swap, admin publish, health restart, pool invalidation, metrics). - Update stored rt_config for subsequent reloads on success.