pub struct ExecClient { /* private fields */ }Expand description
Client for executing commands in the guest over Unix socket.
Uses the Frame wire protocol: sends a Data frame with JSON ExecRequest, receives a Data frame with JSON ExecOutput.
Implementations§
Source§impl ExecClient
impl ExecClient
Sourcepub async fn connect(socket_path: &Path) -> Result<Self>
pub async fn connect(socket_path: &Path) -> Result<Self>
Connect to the exec server via Unix socket.
Verifies the socket is connectable.
Sourcepub fn socket_path(&self) -> &Path
pub fn socket_path(&self) -> &Path
Get the socket path this client is connected to.
Sourcepub async fn exec_command(&self, request: &ExecRequest) -> Result<ExecOutput>
pub async fn exec_command(&self, request: &ExecRequest) -> Result<ExecOutput>
Execute a command in the guest.
Sends a Data frame with JSON ExecRequest, reads a Data frame with JSON ExecOutput.
Sourcepub async fn exec_stream(&self, request: &ExecRequest) -> Result<StreamingExec>
pub async fn exec_stream(&self, request: &ExecRequest) -> Result<StreamingExec>
Execute a command in streaming mode.
Sends a Data frame with JSON ExecRequest (streaming=true), then reads multiple frames: ExecChunk frames for stdout/stderr data, and a final ExecExit frame with the exit code.
Returns a StreamingExec handle for reading events.
Sourcepub async fn file_transfer(&self, request: &FileRequest) -> Result<FileResponse>
pub async fn file_transfer(&self, request: &FileRequest) -> Result<FileResponse>
Transfer a file to/from the guest.
Sends a Data frame with JSON FileRequest, reads a Data frame with JSON FileResponse.
Sourcepub async fn heartbeat(&self) -> Result<bool>
pub async fn heartbeat(&self) -> Result<bool>
Send a Heartbeat frame and wait for a Heartbeat response.
Returns true if the exec server responds, false otherwise.
Sourcepub async fn signal_main(&self, signal: i32) -> Result<bool>
pub async fn signal_main(&self, signal: i32) -> Result<bool>
Ask the guest to deliver signal (a signal number, e.g. 15 for SIGTERM)
to the main container process for graceful shutdown. The guest runs the
container’s own stop handler; when it exits, guest init exits and the VM
stops cleanly. Returns Ok(true) if the guest acknowledged, Ok(false)
if it did not respond (caller should fall back to a hard stop).
Sourcepub async fn spawn_main(&self, spec_json: Option<&[u8]>) -> Result<bool>
pub async fn spawn_main(&self, spec_json: Option<&[u8]>) -> Result<bool>
Ask a guest that booted IDLE (BOX_DEFERRED_MAIN=1) to spawn its container
command — already known to the guest via BOX_EXEC_* — as the MAIN process.
The spawned main inherits the console (so its output reaches the json-file
logs) and drives the VM lifecycle. Returns Ok(true) if acknowledged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExecClient
impl RefUnwindSafe for ExecClient
impl Send for ExecClient
impl Sync for ExecClient
impl Unpin for ExecClient
impl UnsafeUnpin for ExecClient
impl UnwindSafe for ExecClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more