Skip to main content

Crate squib_api

Crate squib_api 

Source
Expand description

Firecracker-compatible HTTP API server for squib.

squib-api exposes the same OpenAPI surface that upstream Firecracker speaks over a Unix domain socket: same paths, same JSON shapes, same status codes, same {"fault_message": "..."} error body, same Server: Firecracker API response header. Per-endpoint compatibility lives in 21-api-compat-matrix.md; the machinery is pinned in 20-firecracker-api.md.

§Architecture

  • schemasRaw* request/response shapes plus validated newtypes whose only construction path is via TryFrom. Per 10-data-model.md § 2.3, validation is the constructor; “unvalidated DriveConfig” is unrepresentable.
  • action — the ApiAction / ApiResponse enum the API thread posts onto the bounded mpsc channel into the VMM event loop.
  • controller — the RuntimeApiController with ArcSwap read-mirror, lock-free read fast path, and per-action-class tokio::time::timeout (D26).
  • error — the wire-shape FaultMessage, ApiError (incl. squib-only 504), and the IntoResponse impl that translates everything into the upstream wire shape.
  • handlers — axum endpoint handlers for every Firecracker route.
  • server — axum router on tokio::net::UnixListener plus the serve entry.
  • replay--config-file static-config replay path; deterministic order, identical validation/dispatch as the HTTP layer.

Re-exports§

pub use action::ActionClass;
pub use action::ApiAction;
pub use action::ApiResponse;
pub use controller::ActionReceiver;
pub use controller::ActionSender;
pub use controller::ControllerSnapshot;
pub use controller::RuntimeApiController;
pub use controller::TimeoutTable;
pub use error::ApiError;
pub use error::FaultMessage;
pub use error::Result;
pub use replay::ReplayError;
pub use replay::parse_config_file;
pub use replay::replay_config;
pub use schemas::InstanceInfo;
pub use schemas::VersionResponse;
pub use schemas::VmState;
pub use server::DEFAULT_MAX_PAYLOAD;
pub use server::FIRECRACKER_SERVER_HEADER;
pub use server::MAX_MAX_PAYLOAD;
pub use server::MIN_MAX_PAYLOAD;
pub use server::ServeOptions;
pub use server::bind_listener;
pub use server::router;
pub use server::serve;
pub use server::serve_bound;

Modules§

action
Cross-thread ApiAction / ApiResponse enums.
controller
RuntimeApiController — channel to VMM + lock-free read mirror + timeout taxonomy.
error
Error type and the wire-shape Firecracker uses for failed requests.
handlers
Axum handlers per 20-firecracker-api.md § 2.
replay
--config-file static-config replay path.
schemas
Request and response types that mirror Firecracker’s OpenAPI shapes.
server
Axum router on a Unix domain socket; the serve entrypoint.