pub struct FirecrackerApiClient { /* private fields */ }Expand description
HTTP client that speaks to one Firecracker VMM over its Unix API socket.
Linux-only — Firecracker is a Linux/KVM-only VMM. The struct is still
declared on every platform (with no methods available off-Linux) so that
path-typing in the Linux body of lib.rs does not trigger downstream
rebuild thrash; non-Linux hosts cannot construct one because new is
gated.
Implementations§
Source§impl FirecrackerApiClient
impl FirecrackerApiClient
pub fn new(socket_path: impl Into<PathBuf>) -> Self
Sourcepub async fn wait_for_ready(&self) -> Result<(), CellosError>
pub async fn wait_for_ready(&self) -> Result<(), CellosError>
Wait up to [CONNECT_TIMEOUT] for the socket file to appear, then
verify connectivity with a GET / request (returns 404 — that’s fine,
it proves the VMM is listening).
Sourcepub async fn put<T: Serialize>(
&self,
path: &str,
body: &T,
) -> Result<StatusCode, CellosError>
pub async fn put<T: Serialize>( &self, path: &str, body: &T, ) -> Result<StatusCode, CellosError>
PUT <path> with a JSON body. Returns the HTTP status code.
Firecracker returns 204 No Content for successful configuration calls.
Sourcepub async fn patch<T: Serialize>(
&self,
path: &str,
body: &T,
) -> Result<StatusCode, CellosError>
pub async fn patch<T: Serialize>( &self, path: &str, body: &T, ) -> Result<StatusCode, CellosError>
PATCH <path> with a JSON body. Returns the HTTP status code.
Used by the L2-06 warm-pool path to drive PATCH /vm with
{"state":"Paused"} between InstanceStart and PUT /snapshot/create.
Firecracker rejects PUT /snapshot/create unless the VM is Paused —
snapshotting a Running VM would race with vCPU writes to RAM.
Trait Implementations§
Source§impl Clone for FirecrackerApiClient
impl Clone for FirecrackerApiClient
Source§fn clone(&self) -> FirecrackerApiClient
fn clone(&self) -> FirecrackerApiClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more