pub struct LaunchedChild {
pub workdir: PathBuf,
pub session_id: String,
pub records_dir: PathBuf,
pub capsule_url: String,
pub argv: Vec<String>,
pub env: Vec<(String, String)>,
pub delegation_id: Option<String>,
pub door_token: Option<DoorToken>,
pub formation_id: Option<FormationId>,
pub workdir_snapshot: Option<WorkdirSnapshot>,
/* private fields */
}Expand description
A running child capsule and the handles to end it.
Fields§
§workdir: PathBufThe directory the parent created for this child in its records directory’s
[CHILDREN_DIR], and passed as its --workdir: the child’s work folder. Its trace, its
completion.json and an agent child’s out/ are in Self::records_dir.
session_id: StringThe session id the child’s runtime minted for itself.
records_dir: PathBufThe child’s records directory, as the child reported it on its readiness line: where its
trace, its completion.json and an agent child’s out/ are. Never derived from
Self::workdir.
capsule_url: StringThe child’s A2A endpoint, http://host:port. Empty for a script capsule, which binds no
port and has already finished by the time it reports.
argv: Vec<String>The argument vector the parent built, in order, starting with the binary.
Exposed so a caller — a test, notably — can assert what was passed without reading
/proc. It carries no token: the approval goes in on standard input.
env: Vec<(String, String)>The complete environment the parent built for this child, in insertion order. Also carries no token.
delegation_id: Option<String>The id this launch’s completion reports under, None when no spawner was supplied.
Minted here, injected into the child as part of SPAWNER_ENV, and echoed back on the
completion — the one value that joins a delegation to the task it produces at the parent.
door_token: Option<DoorToken>The operator token of a child that declares network.authentication, read from
tokens.operator on its readiness line. The parent presents it on every call to the
child’s door. Never printed by Debug.
formation_id: Option<FormationId>The formation the child reports it joined, read from formation_id on its readiness
line. None when the line carries no such key, or a value that is not a formation id.
workdir_snapshot: Option<WorkdirSnapshot>What was copied from the parent’s work folder into Self::workdir before the child
started, or None for a child that started in an empty one.
Implementations§
Source§impl LaunchedChild
impl LaunchedChild
Sourcepub fn stderr_tail(&self) -> Vec<String>
pub fn stderr_tail(&self) -> Vec<String>
The child’s last [CHILD_STDERR_TAIL_LINES] lines, oldest first.
The same lines a crash completion quotes back, exposed so a caller can read what the child said without scraping the stderr they were already echoed to.
Sourcepub fn begin_ending(&self)
pub fn begin_ending(&self)
Mark the ending deliberate and send the child SIGTERM, without waiting for it.
A parent ending several children calls this on each before Self::shutdown or Drop on
any, so they wind down together and the whole ending waits one CHILD_END_GRACE rather
than one per child. A child already exited is left to be reaped.
Sourcepub fn shutdown(&mut self) -> Result<(), RuntimeError>
pub fn shutdown(&mut self) -> Result<(), RuntimeError>
End the child — SIGTERM, up to CHILD_END_GRACE to exit, then SIGKILL — and reap
it. Idempotent: a second call, or a call after Drop has already run, does nothing.
Marks the ending as deliberate, so the watcher records the delegation as terminated and
posts nothing: the only party that would be told is the party that did it.
Sourcepub fn is_being_ended(&self) -> bool
pub fn is_being_ended(&self) -> bool
Whether the child is winding down from a deliberate SIGTERM and has not been reaped.
The door asks this of a completion that arrives for a delegation still in the set: such a
completion is the child’s own account of a cancel its parent’s side chose, posted before
the launcher’s terminated record replaces it, and it is not the delegation’s outcome.
Sourcepub fn watcher_finished(&self) -> bool
pub fn watcher_finished(&self) -> bool
Whether the completion watcher behind this child has finished: it has seen the child end
and recorded, and posted, whatever it records and posts. true for a child no watcher
observes.
A delegating task that ends a child asks this before it lets the child’s handle go, so the
child’s completion.json says how it ended before the parent’s own process can exit.
Sourcepub fn has_exited(&self) -> bool
pub fn has_exited(&self) -> bool
Whether the child’s process has ended, by its own exit or by being ended. The completion watcher’s own poll: a process that exited on its own is reaped and its lifeline closed.
Never blocks: a delegating task asks this while it gives a child that has just reported its outcome a moment to finish exiting.
Trait Implementations§
Source§impl Debug for LaunchedChild
impl Debug for LaunchedChild
Source§impl Drop for LaunchedChild
impl Drop for LaunchedChild
Source§fn drop(&mut self)
fn drop(&mut self)
Ends and reaps as LaunchedChild::shutdown does, so a parent that returns early —
including by panicking — leaves no orphaned capsule process behind holding a port and a
directory. Deliberate on the same terms. A child that has already exited is only reaped.
Auto Trait Implementations§
impl !RefUnwindSafe for LaunchedChild
impl !UnwindSafe for LaunchedChild
impl Forget for LaunchedChild
impl Freeze for LaunchedChild
impl Move for LaunchedChild
impl Send for LaunchedChild
impl Sync for LaunchedChild
impl Unpin for LaunchedChild
impl UnsafeUnpin for LaunchedChild
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more