tutti_core/process_manager/
base.rs

1use std::time::Duration;
2
3use crate::{
4    error::Result,
5    process_manager::types::{CommandSpec, ProcId, Spawned},
6};
7
8#[async_trait::async_trait]
9pub trait ProcessManager: Send + Sync {
10    /// Spawn a new process.
11    async fn spawn(&mut self, spec: CommandSpec) -> Result<Spawned>;
12    /// Gracefully shutdown a process.
13    async fn shutdown(&mut self, id: ProcId) -> Result<()>;
14    /// Wait for a process to exit.
15    async fn wait(&mut self, id: ProcId, d: Duration) -> Result<Option<i32>>;
16    /// Forcefully kill a process.
17    async fn kill(&mut self, id: ProcId) -> Result<()>;
18}