#[derive(Debug)]
pub(in crate::worker) enum PingFailure {
Unaskable(String),
Unanswered(String),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(in crate::worker) enum ProbedTransport {
Liminal {
pid: u64,
},
Grpc,
}
impl ProbedTransport {
pub(in crate::worker) const fn kind(self) -> aion_core::WorkerTransport {
match self {
Self::Liminal { .. } => aion_core::WorkerTransport::Liminal,
Self::Grpc => aion_core::WorkerTransport::Grpc,
}
}
pub(in crate::worker) const fn name(self) -> &'static str {
self.kind().name()
}
pub(in crate::worker) const fn pid(self) -> Option<u64> {
match self {
Self::Liminal { pid } => Some(pid),
Self::Grpc => None,
}
}
}
#[cfg(test)]
mod tests {
use super::ProbedTransport;
#[test]
fn a_grpc_probe_reports_no_connection_pid() {
assert_eq!(ProbedTransport::Grpc.pid(), None);
assert_eq!(ProbedTransport::Grpc.name(), "grpc");
assert_eq!(ProbedTransport::Liminal { pid: 7 }.pid(), Some(7));
assert_eq!(ProbedTransport::Liminal { pid: 7 }.name(), "liminal");
}
}