Skip to main content

Children

Struct Children 

Source
pub struct Children { /* private fields */ }
Expand description

The children registry.

Implementations§

Source§

impl Children

Source

pub fn new(exe: PathBuf, events: FrameSink, reap_tx: Sender<Reaped>) -> Children

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, node: NodeId) -> Option<&Child>

Source

pub fn get_mut(&mut self, node: NodeId) -> Option<&mut Child>

Source

pub fn iter(&self) -> impl Iterator<Item = (&NodeId, &Child)>

Source

pub fn count_kind(&self, f: impl Fn(&ChildKind) -> bool) -> usize

Source

pub fn pid_of(&self, node: NodeId) -> Option<i32>

The OS pid of a live child (for logs; the reaper owns lifecycle).

Source

pub fn has_pid(&self, pid: i32) -> bool

Whether pid is a tracked child (a reap for an unknown pid needs no frame-ordering deferral).

Source

pub fn reap_sender(&self) -> Sender<Reaped>

The reap channel — for supervised children spawned OUTSIDE this registry (instance-tier daemons, which have no control channel) whose exits must still route to this reactor.

Source

pub fn join_reader_of(&mut self, pid: i32)

Join pid’s stdout reader — after this, all its frames are queued.

Source

pub fn spawn( &mut self, payload: &SpawnPayload, kind: ChildKind, deadline: Duration, ) -> Result<NodeId>

Spawn a child (tracked with the reaper). The payload’s telemetry must already carry the correlation ids.

Source

pub fn on_frame(&mut self, node: NodeId, msg: &AgentMsg) -> bool

A frame arrived from node: refresh liveness (returns whether known).

Source

pub fn mark_settled(&mut self, node: NodeId)

A terminal frame was folded back in for node: its unit is settled, so the reap path must not fail it a second time. Marks the just-reaped record too, so a failure routed from the reap path is not re-entered.

Source

pub fn is_settled(&self, node: NodeId) -> bool

Whether node’s unit has been settled by a terminal frame — answerable after the child is gone, which is the only time the question is asked. A node we never knew counts as settled: there is nothing left to fail.

Source

pub fn reaped_kind(&self, node: NodeId) -> Option<ChildKind>

The kind of the most recently reaped child, so its failure can still be routed (and its reservation released) once on_reaped has removed it.

Source

pub fn on_reaped(&mut self, r: &Reaped) -> Option<(NodeId, Child)>

A child was reaped: forget it and return its record.

Source

pub fn send(&mut self, node: NodeId, msg: &ControlMsg) -> bool

Send a control frame to a child.

Source

pub fn cancel(&mut self, node: NodeId, reason: &str) -> bool

Cancel a child gracefully (the kill ladder escalates on drain).

Source

pub fn kill(&mut self, node: NodeId)

Kill a child now (its whole process group).

Source

pub fn tick(&mut self) -> Vec<(NodeId, Health)>

Periodic maintenance: pings + liveness. Returns the nodes that must be torn down (stuck / past deadline).

Source

pub fn begin_drain(&mut self, reason: &str)

Begin the drain: cancel every child; the ladder escalates.

Source

pub fn drive_drain(&mut self, force: bool) -> bool

Drive the ladder: true when every child is gone.

Source

pub fn abandon(&mut self)

Forget every remaining child (after a forced kill at abandon).

Source

pub fn status(&self) -> Value

A status view.

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, 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, <T as TryFrom<U>>::Error>

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