pub struct ModuleSpec {
pub module_id: String,
pub program: PathBuf,
pub args: Vec<String>,
pub env: Vec<(String, String)>,
pub reserved: bool,
pub reserved_prefixes: Vec<String>,
pub protocol: ModuleProtocol,
pub overlap: ModuleOverlap,
}Expand description
How to launch one singleton module process.
Fields§
§module_id: String§program: PathBuf§args: Vec<String>§env: Vec<(String, String)>§reserved: boolWhen true this is a reserved module: each spawn gets a fresh one-time launch nonce that the child must echo in its HELLO, so only the daemon-spawned process can register this module_id (a security-boundary module like the credential vault must not be impersonable while it is down/restarting).
reserved_prefixes: Vec<String>Module-id prefixes this supervised module owns for reserved HELLO checks.
Prefixes come from daemon config and must end in : before they reach the
supervisor; the owner module’s current spawn nonce authorizes claims under
each prefix.
protocol: ModuleProtocolThe wire protocol this module speaks, as DECLARED in daemon config.
ModuleProtocol::None changes five things and nothing else: health
probing is suppressed, teardown sends SIGTERM before waiting,
route.open is refused, the spawn passes NO --subc <path> argument
and NO launch nonce, and a clean exit the daemon did not request is
restarted as a crash rather than recorded as a stop (see on_child_exit:
a stock program exits 0 on a stray SIGTERM, and a stop would leave it
down for good). SUBC_MODULE_ID still goes into the environment,
because a process ignores an environment variable it does not read.
The argument is the part that cannot be “harmless to a process that
ignores it”: a stock binary exits on an unknown flag before it listens
(nats-server: “flag provided but not defined: -subc”), which is how the
first conformance run against this mode found it. The nonce is withheld
because a process that will never present it gains nothing from holding
it, and a secret in the environment of a process that does not need it is
a leak surface for no benefit.
overlap: ModuleOverlapWhether two processes of this module may run at once, which is what a blue/green swap does for the length of its overlap. Declared in daemon config because the daemon must be able to answer it while the module is down, and so a module cannot talk itself into it after registering.