pub struct SupervisorHandle { /* private fields */ }Expand description
Shared daemon lookup table for supervised module handles.
Shared by clone between the Supervisor (which spawns processes) and the
channel-0 control handler (which verifies HELLOs and consumer route opens), so
launch nonces recorded at spawn are checked by the same daemon instance.
Implementations§
Source§impl SupervisorHandle
impl SupervisorHandle
pub fn new() -> Self
Sourcepub fn set_spawn_nonce(&self, module_id: &str, nonce: String)
pub fn set_spawn_nonce(&self, module_id: &str, nonce: String)
Record the launch nonce from a supervised spawn, replacing any prior nonce so a respawn invalidates stale consumer identities.
Sourcepub fn set_reserved_nonce(&self, module_id: &str, nonce: String)
pub fn set_reserved_nonce(&self, module_id: &str, nonce: String)
Record the launch nonce expected from the next HELLO for a reserved module, replacing any prior nonce (a respawn invalidates the previous one).
Sourcepub fn set_reserved_prefixes(&self, owner_module_id: &str, prefixes: &[String])
pub fn set_reserved_prefixes(&self, owner_module_id: &str, prefixes: &[String])
Record namespace prefixes owned by a supervised module.
Whether a HELLO claiming module_id is authorized. An exact reserved id is
authorized only by its expected nonce; otherwise a matching reserved prefix
is authorized by the owner module’s current spawn nonce. Non-reserved ids
with no matching prefix are always authorized.
Whether a consumer connection proved it came from a daemon-spawned module.
Absence of an expected spawn nonce is a hard failure: consumer_identity is accepted only for module ids the supervisor has spawned.
Sourcepub fn spawn_launch_nonce_for(&self, module_id: &str) -> Option<String>
pub fn spawn_launch_nonce_for(&self, module_id: &str) -> Option<String>
Test/support lookup for the current launch nonce of a supervised spawn.
Sourcepub fn reserved_launch_nonce_for(&self, module_id: &str) -> Option<String>
pub fn reserved_launch_nonce_for(&self, module_id: &str) -> Option<String>
Test/support lookup for the HELLO-gating nonce of a reserved module.
pub fn insert(&self, module: SupervisedModule) -> Option<SupervisedModule>
pub fn get(&self, module_id: &str) -> Option<SupervisedModule>
Sourcepub fn record_deliberate_severance(
&self,
module_id: &str,
) -> Result<bool, SuperviseError>
pub fn record_deliberate_severance( &self, module_id: &str, ) -> Result<bool, SuperviseError>
Arm the one-shot marker for the module process that this caller deliberately initiated severance against. Generic connection teardown must not call this: a surviving process would otherwise retain an exemption for a later genuine crash.