use crate::child_runner::runner::{ChildRunHandle, ChildRunReport};
use crate::control::command::{CommandMeta, CommandResult, ControlCommand};
use crate::error::types::SupervisorError;
use crate::id::types::{ChildId, ChildStartCount, Generation, SupervisorPath};
use crate::runtime::lifecycle::RuntimeExitReport;
use tokio::sync::oneshot;
#[derive(Debug)]
pub enum RuntimeLoopMessage {
Control {
command: ControlCommand,
reply_sender: oneshot::Sender<Result<CommandResult, SupervisorError>>,
},
ChildStart(ChildStartMessage),
ControlPlane(ControlPlaneMessage),
}
#[derive(Debug)]
pub enum ChildStartMessage {
Exited {
report: Box<ChildRunReport>,
},
DelayedSpawnAttached {
child_id: ChildId,
path: SupervisorPath,
generation: Generation,
attempt: ChildStartCount,
handle: ChildRunHandle,
},
StartFailed {
child_id: ChildId,
message: String,
},
}
#[derive(Debug)]
pub enum ControlPlaneMessage {
Shutdown {
meta: CommandMeta,
reply_sender: oneshot::Sender<Result<RuntimeExitReport, SupervisorError>>,
},
ReplayChildExitForTest {
report: Box<ChildRunReport>,
},
}