Expand description
The in-VM client, with the reqwest backend and the sockets.
Modules§
- complete
- Run one command to exactly one result:
Session::run_to_completion. - exec
- The exec handle and the cursor-driven stream, with the production exec id.
- files
- File and tar transfer. Four routes, opaque bodies, one query type.
- forward
- A local TCP listener that forwards HTTP and WebSocket traffic to one guest port.
- http
- The HTTP seam and the production backend.
- keepalive
- Keeping a VM awake from outside while work runs inside it.
- proxy
- The two-header proxy auth and the mint schedule, on tokio’s clock in production.
- serve
- The serving loops behind
microvm tunnelandmicrovm port-forward, and behind the SDKs’ tunnel and port-forward handles (#263). - shell
- The client half of
microvm shell: a real PTY carried over the endpoint’s shell WebSocket. Issue #69, Option B — a thin client over the platform’s session, not a line-mode wrapper over exec. - split
- One exec’s output as two byte channels, stdout and stderr.
- sse
- Incremental Server-Sent Events parsing, and the typed events the daemon emits.
- tunnel
- The client half of the TCP relay: a local TCP connection carried over a WebSocket.
Structs§
- Client
Deadline - What the client did when its own deadline expired (BIND-9, BIND-10).
- Completion
Options - The knobs of a run-to-completion call.
- Completion
Plan - A validated run-to-completion call, separable from the start request it was planned for.
- Exec
Handle - One exec, addressed by its caller-minted id.
- Exec
Result - An exec’s phase and, once it has one, its outcome.
- Forward
Client - The HTTP client a forwarder’s hops go through.
- Forward
Spec - Where the forwarder listens and what it forwards to.
- Frame
- One complete SSE frame: its event name and its raw
data:text. - GapLog
- The gaps a split drive has recorded so far, shared with the drive.
- Http
Request - One request, already fully addressed: absolute URL, every header, whole body.
- Http
Response - One response, body already collected.
- Keep
Awake - A keepalive’s policy. Build with
KeepAwake::new, check withKeepAwake::validate. - Keep
Awake Report - What a finished keepalive did.
- Keep
Awake Task - A keepalive running as a background task. Dropping it stops the task.
- Launch
Metrics - Measurements observed by this client’s launch, in Unix seconds for timestamps. Absent timestamps mean that phase has not been observed by this client.
- Output
Gap - One byte range the daemon couldn’t replay, under
GapPolicy::Event. - Proxy
Auth - Mints, caches, and refreshes the proxy token for one MicroVM and one port.
- Proxy
Token - The minted token, as the control plane returns it: a map of header name to value.
- Reqwest
Backend - The production backend: one pooled reqwest client.
- Session
- The control API of one running MicroVM.
- Session
Builder - Builds a
Session. SeeSession::builder. - Split
- One exec’s output as two channels, and the drive that fills them.
- SseParser
- Feed bytes, get whole frames out. Holds a partial frame across feeds.
- Stream
End - Why a stream stopped, and where a resume would pick up.
- Stream
Options - How a stream should behave. See
ExecHandle::stream_with. - Tokio
Clock - The production clock: tokio’s monotonic clock and the system’s wall clock.
- Transport
- The transport: a backend, the agent token, and the proxy auth every request needs.
Enums§
- EndReason
- The three ways a stream ends without an error.
- Exec
Event - One decoded stream event.
- Forward
Event - What the forwarder did, for a caller that wants to report progress.
- GapPolicy
- What a split drive does when the daemon reports evicted output. See the module docs.
- Keep
Awake End - Why a keepalive ended without an error.
- Kill
Answer - The daemon’s answer to the kill the client sent when its deadline expired.
- Tunnel
End - What ended a tunnel, and whether the caller should treat it as a failure.
Constants§
- DEFAULT_
AGENT_ PORT - Compatibility alias for the shared daemon listener default.
- DEFAULT_
BIND - Where a tunnel or port-forward listens by default: loopback, on a port the OS picks. Loopback keeps the VM’s credentials from being exposed to remote connections.
- DEFAULT_
BOOTSTRAP_ TIMEOUT - How long to wait for a daemon to report bootstrapped, once its VM is RUNNING: the wait
crate::sandbox::Sandbox::runmakes after the RUNNING one, andSession::wait_until_ready’s default in the bindings. - DEFAULT_
CLIENT_ GRACE - The default
CompletionOptions::client_grace: how long past the daemon’s own deadline the client waits before it kills, and how long it then waits for the killed exec’s result. - DEFAULT_
EXCHANGE_ TIMEOUT - The limit for the response head and for each read of a proxied response body.
- DEFAULT_
EXEC_ WAIT - The deadline the bindings pass to
ExecHandle::wait,ExecHandle::wait_and_ackand a one-shotSession::run_syncwhen their caller names none: five minutes, the Python client’s figure. Those methods take a deadline, so core itself never reads this; it’s here so both bindings default to one figure. - DEFAULT_
READY_ TIMEOUT Deprecated - The old name of
DEFAULT_BOOTSTRAP_TIMEOUT, kept for one release. - DEFAULT_
REFRESH_ AFTER - When to re-mint: half
MAX_TOKEN_LIFETIME. See the module docs for why not fifty-nine minutes. - DEFAULT_
REQUEST_ TIMEOUT - How long one non-streaming request may take.
- MAX_
TOKEN_ LIFETIME - The ceiling the service enforces on a proxy token’s life. Not a choice.
- NO_
TIMEOUT_ CEILING - The client deadline of a request with no
timeout_sec: the longest a MicroVM can live (MAX_DURATION_SEC), since no command outlives the VM it runs in. - PROXY_
AUTH_ HEADER - The header carrying the minted JWE. One of the two keys read out of the
authTokenmap. - PROXY_
PORT_ HEADER - The header naming which of the token’s allowed ports this request targets.
- TIMED_
OUT_ EXIT_ CODE - The exit code GNU
timeout(1)reports for a command its deadline ended, and the oneExecResult::posix_exit_codereports for a deadline (BIND-6). - TUNNEL_
CHUNK_ BYTES - Bytes read from the local connection per relayed frame.
- WS_
AUTH_ SUBPROTOCOL_ PREFIX - The prefix the JWE rides behind in a WebSocket handshake.
- WS_
PORT_ SUBPROTOCOL_ PREFIX - The prefix the target port rides behind in a WebSocket handshake.
- WS_
SUBPROTOCOL - The base subprotocol every MicroVM WebSocket handshake offers first.
Traits§
- Chunk
Source - A body arriving in pieces.
- Clock
- The clock a refresh boundary is measured on. It’s the crate’s one
Clock, and the production one is tokio’s (TokioClock, inmicrovms-edges): a token timed onstd::time::Instantwould never re-mint inside a simulation. Time, injectable so a wait or a refresh boundary is a test rather than a wait. - Http
Backend - The seam. Production and simulated transports implement this.
- Token
Minter - Mints a proxy token. One method, so a test needs no AWS.
Functions§
- exec_
id_ at - A fresh exec id for the wall time
unix, since the epoch:x-plus 16 hex characters, the Python client’s shape. - explain_
close - A sentence for a close code, or
Nonewhen the code explains nothing. - forwards_
request_ header - Whether a header from the local client is forwarded upstream.
- mint_
exec_ id - A fresh exec id from the production clock:
x-plus 16 hex characters. - refusal_
explanation - The 403-vs-502 sentence, or
Nonefor a status that needs no explaining. - relay_
connection - Opens a tunnel to
guest_portand relayslocalover it until either side closes. - tunnel_
url - The
wss://URL for a tunnel toguest_port. - upstream_
url - The absolute URL a proxied request targets, given the endpoint and the request target.
Type Aliases§
- Open
Stream - A streaming response: the head, and the body still to arrive.
- Output
Flow - What an
OutputSinkanswers: a boxed future of continue-or-stop, named so a caller needs nofuturescrate to spell it. - Output
Sink - A callback for output. Only
ExecEvent::Outputis delivered; the result carries the exit status. Answeringstd::ops::ControlFlow::Breakstops delivery, and the call still waits for and acks the exec, so nothing is left running unobserved (BIND-8). - Running
Gate - Whether the VM behind a keepalive is still one it may poll. See the module docs.
- Shared
Backend - A backend behind an
Arc, which is what acrate::session::Sessionholds. - Split
Item - What a channel carries: a chunk of one side’s bytes, or the error that ended it.