Skip to main content

Module exec

Module exec 

Source
Expand description

Exec wire types: the bodies, queries, and SSE event payloads of /v1/exec/*.

Every type here derives both halves of serde. The daemon needs only one half of each and a client needs the other, and a type that carries one half is a type the other side has to hand-write — which is the drift this crate exists to prevent. The published docs/schema.json is generated from these same attributes under both contracts, so a shape change is a schema diff rather than a surprise.

Structs§

ErrorBody
The JSON error body every failing control route returns.
ExitEvent
The terminal exit SSE event. Emitted before the stream ends, so a client that sees the body close without one knows the connection failed rather than the command finishing.
GapEvent
One gap SSE event: the byte range a lagging or late subscriber lost.
KillResponse
POST /v1/exec/{id}/kill response.
Outcome
Captured output and exit status of a finished exec.
OutputEvent
One output SSE event.
PollResponse
ProcGroup
One entry of GET /v1/procs: an exec’s process group as the daemon sees it.
ProcsResponse
GET /v1/procs response.
StartRequest
A start request. command is either an argv array or, with shell set, a single script string.
StartResponse
StdinRequest
POST /v1/exec/{id}/stdin body.
StdinResponse
POST /v1/exec/{id}/stdin response.
StreamQuery
GET /v1/exec/{id}/stream query.

Enums§

NameOrId
A user or group as a start request names it: a numeric id, or a name the daemon resolves against the guest’s /etc/passwd or /etc/group.
Phase
Where an exec sits in its lifecycle. Mirrors ExecPhase in the model crate.
Shell
How a start request’s command is run: false (an argv), true (/bin/sh -c), or the name of a shell the daemon resolves and runs as <shell> -c.
StreamKind
Which pipe a streamed chunk came from. Both share one offset space, so a client holds one cursor rather than two that can disagree about ordering.

Constants§

ERROR_ALREADY_ACKED
An earlier ack already released the output.
ERROR_MALFORMED_REQUEST
The body is not a valid request for this route. Always 400, never 404.
ERROR_POWEROFF_UNAVAILABLE
The requested shutdown is unavailable with the daemon’s current privileges.
ERROR_SPAWN_FAILED
The child could not be spawned. 500, deliberately not 404.
ERROR_STDIN_CLOSED
stdin was closed by an earlier eof, or the child stopped reading. 410: a retry will never succeed.
ERROR_STDIN_NOT_REQUESTED
The exec was started without stdin: true. Fixable at start time, hence 409.
ERROR_STDIN_WRITE_FAILED
The write to the pipe failed for a reason other than a broken pipe.
ERROR_STDIN_WRITE_TIMEOUT
The child did not read within the configured window. Retryable, and some bytes may already have been written.
ERROR_STDIN_WRITE_TOO_LARGE
The decoded write exceeds the configured per-write cap.
ERROR_STILL_RUNNING
The exec has not exited, so acking would drop output still being written.
ERROR_UNKNOWN_EXEC
No exec is registered under this id, or its entry was collected after an ack.
ERROR_UNKNOWN_GROUP
A start request named a group the guest’s /etc/group does not contain. 400, and nothing was spawned; detail names the group.
ERROR_UNKNOWN_SHELL
A start request named a shell that no searched directory holds as an executable file. 400, and nothing was spawned; detail names the shell and where it looked.
ERROR_UNKNOWN_USER
A start request named a user the guest’s /etc/passwd does not contain. 400, and nothing was spawned; detail names the user.
EVENT_EXIT
EVENT_GAP
EVENT_OUTPUT
The event: names on GET /v1/exec/{id}/stream.