pub trait ProcessManager:
Send
+ Sync
+ Debug {
// Required methods
fn spawn_child<'life0, 'async_trait>(
&'life0 self,
params: SpawnParams,
) -> Pin<Box<dyn Future<Output = Result<ChildHandle, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn attach_connection<'life0, 'async_trait>(
&'life0 self,
pid: ProcessId,
conn: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_children<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChildHandle>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn terminate_tree<'life0, 'async_trait>(
&'life0 self,
pid: ProcessId,
force: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn wait_for_exit<'life0, 'async_trait>(
&'life0 self,
_pid: ProcessId,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn kill_tree<'life0, 'async_trait>(
&'life0 self,
pid: ProcessId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Supervisor/process manager for spawning and tracking child trees with OS-level supervision.
Required Methods§
fn spawn_child<'life0, 'async_trait>(
&'life0 self,
params: SpawnParams,
) -> Pin<Box<dyn Future<Output = Result<ChildHandle, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn attach_connection<'life0, 'async_trait>(
&'life0 self,
pid: ProcessId,
conn: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_children<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChildHandle>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn terminate_tree<'life0, 'async_trait>(
&'life0 self,
pid: ProcessId,
force: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn terminate_tree<'life0, 'async_trait>(
&'life0 self,
pid: ProcessId,
force: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Terminate a process tree. This is invoked by liveness checks such as the heartbeat tracker when a connection is considered dead.
Provided Methods§
Sourcefn wait_for_exit<'life0, 'async_trait>(
&'life0 self,
_pid: ProcessId,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_for_exit<'life0, 'async_trait>(
&'life0 self,
_pid: ProcessId,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Wait for a process to exit, up to timeout.
Returns Ok(true) if the process is known to have exited within the
timeout, Ok(false) if the wait timed out.
Platform managers should override this to actually reap/wait on the underlying child handle. The default implementation is conservative and simply waits out the timeout.