pub struct MachineConnector { /* private fields */ }Expand description
A helper inside one machine’s PID namespace handing out connected sockets.
Implementations§
Source§impl MachineConnector
impl MachineConnector
Sourcepub fn spawn(
leader_pid: u32,
timeout: Duration,
) -> Result<Self, MachineConnectorError>
pub fn spawn( leader_pid: u32, timeout: Duration, ) -> Result<Self, MachineConnectorError>
Spawn a connector for the machine whose leader is leader_pid.
Blocking: joins the namespace on a short-lived thread, spawns the
helper and waits (at most timeout) until it reports that it opened
the machine’s root and dropped its privileges.
pub fn leader_pid(&self) -> u32
Sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
Whether the helper is still running. It only exits on its own when its machine goes away or on error, so a cached connector that is no longer alive must be replaced rather than reused.
Sourcepub fn connect_blocking(
&self,
socket: MachineSocket,
) -> Result<UnixStream, MachineConnectorError>
pub fn connect_blocking( &self, socket: MachineSocket, ) -> Result<UnixStream, MachineConnectorError>
Connect to socket inside the machine, blocking for the round trip.
Sourcepub async fn connect(
self: &Arc<Self>,
socket: MachineSocket,
) -> Result<Connection>
pub async fn connect( self: &Arc<Self>, socket: MachineSocket, ) -> Result<Connection>
Connect to socket inside the machine and wrap it for zlink.
The tokio stream is created on the calling runtime, so this also works from the per-call current-thread runtimes the streaming collectors use.