Skip to main content

LaunchedChild

Struct LaunchedChild 

Source
pub struct LaunchedChild {
    pub workdir: PathBuf,
    pub session_id: String,
    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>,
    /* private fields */
}
Expand description

A running child capsule and the handles to end it.

Fields§

§workdir: PathBuf

The directory the parent created for this child, and passed as its --workdir. The child’s own session artifacts land at <workdir>/.murmur/<session_id>/.

§session_id: String

The session id the child’s runtime minted for itself.

§capsule_url: String

The 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.

Implementations§

Source§

impl LaunchedChild

Source

pub fn pid(&self) -> u32

The child’s operating-system process id. 0 once it has been reaped.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for LaunchedChild

Source§

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.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more