pub enum Event {
ImageBuilt {
image_identifier: String,
image_name: String,
},
Launched {
image_identifier: String,
endpoint: String,
region: String,
},
Exec {
exec_id: String,
exit_code: Option<i32>,
truncated: bool,
writers_may_be_alive: Option<bool>,
},
HookObserved {
hook: String,
fired_at: u64,
},
Suspended,
Resumed,
Terminated {
terminate_accepted: bool,
undeleted: Vec<String>,
},
}Expand description
One thing that happened to a VM, as the platform told it.
Internally tagged on event so a line reads {"seq":0,"at":...,"event":"launched",...} —
the discriminant is the field a consumer branches on, the same shape the envelope’s type
takes. camelCase on the wire, matching the ledger.
Variants§
ImageBuilt
This invocation’s own build produced the image the VM launched from.
Only run writes this, at run time, because only then is there a VM to key the
record by — a standalone microvm build has no VM id and therefore no history file
to append to.
Launched
The launch was accepted. The identifier and endpoint are the service’s own answer.
Exec
One exec, as the daemon reported it.
exit_code is None for a detached start (the outcome is not known yet) and for a
stream that was cut before its terminal event — reporting 0 for either would turn an
unfinished command into a passing one. writers_may_be_alive travels only when the
daemon’s outcome carried it, which is why it is an Option rather than a defaulted
bool.
HookObserved
The daemon observed one lifecycle-hook invocation.
Read off a health poll rather than pushed: the CLI appends the observations a
GET /v1/health reported wherever it already holds both a health envelope and a
VM id, deduplicated on the (hook, firedAt) pair so re-polling appends nothing.
hook is the route’s own spelling (ready, validate, run, suspend,
resume, terminate) and fired_at is epoch seconds on the daemon’s clock —
distinct from the record’s own at, which is when this CLI learned of it.
See the module docs for the additive-forgery caveat this event carries.
Suspended
The service reported SUSPENDED.
Resumed
The service reported RUNNING again.
Terminated
A teardown ran. The fields are the crate::sandbox::TeardownReport shape:
whether the terminate call was accepted, and what a delete was asked for and did not
remove.