Skip to main content

Supervisor

Trait Supervisor 

Source
pub trait Supervisor {
    // Required methods
    fn spawn(&mut self, svc: &Service) -> Result<Pid>;
    fn terminate(&mut self, pid: Pid) -> Result<()>;
    fn kill(&mut self, pid: Pid) -> Result<()>;
    fn reap_one(&mut self) -> Result<Option<(Pid, i32)>>;
    fn children(&self) -> Vec<(Pid, String)>;
}
Expand description

Minimum interface a supervisor backend must expose.

Designed small enough for a mock to be a few dozen lines and big enough that the scheduler loop doesn’t need to reach past it for anything Linux-specific.

Required Methods§

Source

fn spawn(&mut self, svc: &Service) -> Result<Pid>

Spawn a service; return its PID.

Source

fn terminate(&mut self, pid: Pid) -> Result<()>

Deliver SIGTERM to a PID. For graceful termination.

Source

fn kill(&mut self, pid: Pid) -> Result<()>

Deliver SIGKILL. For the last resort.

Source

fn reap_one(&mut self) -> Result<Option<(Pid, i32)>>

Block until any child exits, or return None immediately if no children have exited. Returns (pid, exit_status) when available.

Source

fn children(&self) -> Vec<(Pid, String)>

Live children tracked by this supervisor.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§