pub struct Children { /* private fields */ }Expand description
The children registry.
Implementations§
Source§impl Children
impl Children
pub fn new(exe: PathBuf, events: FrameSink, reap_tx: Sender<Reaped>) -> Children
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, node: NodeId) -> Option<&Child>
pub fn get_mut(&mut self, node: NodeId) -> Option<&mut Child>
pub fn iter(&self) -> impl Iterator<Item = (&NodeId, &Child)>
pub fn count_kind(&self, f: impl Fn(&ChildKind) -> bool) -> usize
Sourcepub fn pid_of(&self, node: NodeId) -> Option<i32>
pub fn pid_of(&self, node: NodeId) -> Option<i32>
The OS pid of a live child (for logs; the reaper owns lifecycle).
Sourcepub fn has_pid(&self, pid: i32) -> bool
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).
Sourcepub fn reap_sender(&self) -> Sender<Reaped>
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.
Sourcepub fn join_reader_of(&mut self, pid: i32)
pub fn join_reader_of(&mut self, pid: i32)
Join pid’s stdout reader — after this, all its frames are queued.
Sourcepub fn spawn(
&mut self,
payload: &SpawnPayload,
kind: ChildKind,
deadline: Duration,
) -> Result<NodeId>
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.
Sourcepub fn on_frame(&mut self, node: NodeId, msg: &AgentMsg) -> bool
pub fn on_frame(&mut self, node: NodeId, msg: &AgentMsg) -> bool
A frame arrived from node: refresh liveness (returns whether known).
Sourcepub fn mark_settled(&mut self, node: NodeId)
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.
Sourcepub fn is_settled(&self, node: NodeId) -> bool
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.
Sourcepub fn reaped_kind(&self, node: NodeId) -> Option<ChildKind>
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.
Sourcepub fn on_reaped(&mut self, r: &Reaped) -> Option<(NodeId, Child)>
pub fn on_reaped(&mut self, r: &Reaped) -> Option<(NodeId, Child)>
A child was reaped: forget it and return its record.
Sourcepub fn send(&mut self, node: NodeId, msg: &ControlMsg) -> bool
pub fn send(&mut self, node: NodeId, msg: &ControlMsg) -> bool
Send a control frame to a child.
Sourcepub fn cancel(&mut self, node: NodeId, reason: &str) -> bool
pub fn cancel(&mut self, node: NodeId, reason: &str) -> bool
Cancel a child gracefully (the kill ladder escalates on drain).
Sourcepub fn tick(&mut self) -> Vec<(NodeId, Health)>
pub fn tick(&mut self) -> Vec<(NodeId, Health)>
Periodic maintenance: pings + liveness. Returns the nodes that must be torn down (stuck / past deadline).
Sourcepub fn begin_drain(&mut self, reason: &str)
pub fn begin_drain(&mut self, reason: &str)
Begin the drain: cancel every child; the ladder escalates.
Sourcepub fn drive_drain(&mut self, force: bool) -> bool
pub fn drive_drain(&mut self, force: bool) -> bool
Drive the ladder: true when every child is gone.