pub struct NativeServiceRouter { /* private fields */ }Expand description
Composite IoHandler: a service_name hit on a native service name
dispatches natively; otherwise falls back to HTTP.
Mounted for IoType::call_service / IoType::call_external.
The declaration table is provided by the caller
(&'static [NativeServiceDef], owned per family); router lookup always
follows declaration order (independent of the enable set order).
Implementations§
Source§impl NativeServiceRouter
impl NativeServiceRouter
Sourcepub fn new(
defs: &'static [NativeServiceDef],
fallback: Arc<dyn IoHandler>,
) -> Self
pub fn new( defs: &'static [NativeServiceDef], fallback: Arc<dyn IoHandler>, ) -> Self
Build a composite router with the full enable set. fallback is the
HTTP handler used when no native service name matches (typically
Arc<ServiceRegistryHandler>, constructed by the caller per
--allow-loopback).
Sourcepub fn with_enabled(
defs: &'static [NativeServiceDef],
fallback: Arc<dyn IoHandler>,
enabled: &[&str],
) -> Result<Self, String>
pub fn with_enabled( defs: &'static [NativeServiceDef], fallback: Arc<dyn IoHandler>, enabled: &[&str], ) -> Result<Self, String>
Deployment-time subset constructor.
enabledis the set of enabled service names (order-insensitive; router lookup still follows declaration order);- unknown name / duplicate name / empty enable set -> fail-fast
Errwith guidance (never silently ignored); - the host never special-cases concrete names: adding a native capability = append to the declaration table + enable in the manifest.
Sourcepub fn enabled_service_names(&self) -> Vec<&'static str>
pub fn enabled_service_names(&self) -> Vec<&'static str>
Names of the native services enabled on this instance (for health visibility / capability inventory).
Sourcepub fn native_service_names(
defs: &'static [NativeServiceDef],
) -> Vec<&'static str>
pub fn native_service_names( defs: &'static [NativeServiceDef], ) -> Vec<&'static str>
Native service names derived from the declaration table (for server-side binding checks / capability inventory).