pub struct SpawnSpec {
pub binary: PathBuf,
pub args: Vec<String>,
pub env: Vec<(String, String)>,
pub deadline: Duration,
pub drain_grace: Duration,
}Fields§
§binary: PathBuf§args: Vec<String>§env: Vec<(String, String)>Extra env vars to pass to the child (in addition to the handoff envelope).
deadline: DurationAbsolute wall-clock cap on the entire handoff, from
perform_handoff start through Commit send. Sized to comfortably
exceed the consumer’s Drainable::drain + Drainable::seal p99
under load — the library does not interrupt long-but-progressing
hooks (heartbeats from the incumbent keep the supervisor’s
liveness clock fresh), but it will abort once this wall-clock cap
is exceeded regardless of progress.
The supervisor’s reads for SealComplete and Ready extend up to
WIRE_SLACK (1 s) past this cap to pick up replies that were
already on the wire when the deadline elapsed; total wall time can
therefore exceed deadline by up to that slack.
Tuning guidance: set this to p99(drain) + p99(seal) + 30s.
Default: 5 minutes.
drain_grace: DurationWall-clock cap on the drain phase specifically. Useful when the
consumer’s drain has a known upper bound (e.g. drain timeout
configured per-connection) and a tighter cap is wanted than the
overall deadline. The supervisor’s read for Drained extends up
to WIRE_SLACK (1 s) past this cap to pick up an in-flight reply.
Default: 60 seconds.
Implementations§
Source§impl SpawnSpec
impl SpawnSpec
Sourcepub fn new(binary: impl Into<PathBuf>) -> Self
pub fn new(binary: impl Into<PathBuf>) -> Self
Build a spec for binary with the recommended defaults: 5 minute
overall deadline, 60 second drain_grace, empty args and env.
Mutate the returned value or build the struct directly when you need
non-default fields. binary is required because the library has no
useful fallback — accepting a default of PathBuf::new() would just
fail at Command::spawn later with a confusing OS error.