Host snapshots

cua.env.v1 HostSnapshotsService: the checkpoints a host holds, and copying them between your machines.

Checkpoints a host holds and copying them to your other machines: a manifest of files by SHA-256, read grants, resumable LAN copies with verification, and a fallback copy in S3 or a shared folder. The host's cua-spacesd forwards each call to its cua daemon.

Source: libs/cua/proto/cua/env/v1/snapshots.proto.

HostSnapshotsService#

cua.env.v1.HostSnapshotsService

Snapshots a host holds, and copying them between your machines.

A snapshot here is a local checkpoint (cua.daemon.v1.Checkpoint): a sandbox's saved memory and disk that forks start from. Checkpoints are kept on the machine that took them. To fork one on another machine of the pool, that machine first gets a copy:

  • The machine that has it describes it as a manifest: every file (the memory stream, the RAM file, the disk layers and their backing chain, UEFI variables, the guest token) by SHA-256 and size. The manifest's own SHA-256 is the snapshot's digest. It grants read access to those files for a short time (ExportHostSnapshot).
  • The machine that needs it fetches each file it does not have yet, straight from that machine over the LAN (HTTP range requests, so a transfer that stopped resumes where it stopped), checks every file's SHA-256, and only then makes it a checkpoint of its own (PullHostSnapshot). Files are kept by content, so files that several snapshots share (a base disk) are copied once.
  • When that machine cannot be reached, the files come from a copy published to your S3 bucket or Cua Volume (PublishHostSnapshot).

A checkpoint of a Space that a host provides is taken on that host (CreateHostSnapshot), where the Space runs, and stays there: forks of it start there, or on another machine after a copy. DeleteHostSnapshot deletes one the host holds.

A host serves this service to the same callers as HostSpacesService (the owner, its editors, and the env token holder of a direct host), through its cua-spacesd, which forwards each call to the host's cua daemon.

HostSnapshotsService.ListHostSnapshots#

/cua.env.v1.HostSnapshotsService/ListHostSnapshots, unary: ListHostSnapshotsRequest to ListHostSnapshotsResponse.

The snapshots this host holds.

HostSnapshotsService.ExportHostSnapshot#

/cua.env.v1.HostSnapshotsService/ExportHostSnapshot, unary: ExportHostSnapshotRequest to ExportHostSnapshotResponse.

Describes a snapshot (hashing its files the first time) and grants read access to its files for a limited time.

HostSnapshotsService.PullHostSnapshot#

/cua.env.v1.HostSnapshotsService/PullHostSnapshot, server stream: PullHostSnapshotRequest to PullHostSnapshotResponse.

Copies a snapshot to this host from another host (or the fallback), streaming progress, and adds it as a checkpoint once every file is verified. A snapshot this host already holds with the same digest is not copied again.

HostSnapshotsService.PublishHostSnapshot#

/cua.env.v1.HostSnapshotsService/PublishHostSnapshot, server stream: PublishHostSnapshotRequest to PublishHostSnapshotResponse.

Uploads a snapshot this host holds to the fallback store (S3 or Cua Volume), streaming progress. Files already there are not uploaded again.

HostSnapshotsService.CreateHostSnapshot#

/cua.env.v1.HostSnapshotsService/CreateHostSnapshot, unary: CreateHostSnapshotRequest to CreateHostSnapshotResponse.

Checkpoints a Space this host provides (CheckpointSandbox on the host): it keeps running. The owner checkpoints any; another account only the Spaces it created. Fails with NOT_FOUND when the host does not provide that Space, and INVALID_ARGUMENT when the name is taken.

HostSnapshotsService.DeleteHostSnapshot#

/cua.env.v1.HostSnapshotsService/DeleteHostSnapshot, unary: DeleteHostSnapshotRequest to DeleteHostSnapshotResponse.

Deletes a checkpoint this host holds (forks made from it keep running). The owner deletes any; another account only the ones it took here. A pinned checkpoint is refused until it is unpinned. Fails with NOT_FOUND when the host does not hold it.

Types in cua/env/v1/snapshots.proto#

HostSnapshot#

A snapshot a host holds.

Field#TypeDescription
name1stringThe checkpoint's name.
digest2stringSHA-256 of its manifest (hex), or empty when it was never exported.
abi3stringWhich machines can restore it: <engine>/<accelerator>/<arch>, for example qemu/hvf/aarch64. A snapshot forks only on a host whose HostNodeStatus.snapshot_abis lists its ABI.
size_bytes4uint64Bytes of all its files, when known.
source5stringThe sandbox it was taken from (its name on the machine that took it).
created_at_ms6int64When it was taken (Unix milliseconds; 0 when unknown).
pinned7boolPinned: kept until it is unpinned.
shared_memory8boolIts forks share its RAM copy-on-write (a QEMU memory checkpoint).
runtime_type9stringThe engine that holds it (qemu, firecracker, gvisor, ...).
image10stringThe image of the sandbox it was taken from.

SnapshotFallback#

Where hosts fetch a snapshot when the machine that has it cannot be reached: a copy in your S3 bucket, or in a folder every host mounts (your Cua Volume, a NAS share).

Field#TypeDescription
s31SnapshotS3An S3 bucket (or an S3-compatible endpoint). Credentials are the host's own (the AWS default chain on that host).
dir2stringA folder every host mounts, for example your Cua Volume (~/Cua Volume/snapshots); a leading ~ is each host's home. Empty with s3 unset: no fallback.

SnapshotS3#

An S3 location for snapshot files.

Field#TypeDescription
bucket1stringThe bucket.
prefix2stringKey prefix, for example cua-snapshots/.
region3stringRegion (empty: the host's default).
endpoint4stringEndpoint of an S3-compatible service (empty: AWS).

SnapshotSource#

A host to fetch snapshot files from.

Field#TypeDescription
url1stringBase URL of the host's snapshot files, for example http://192.168.1.20:3211/v1/snapshots.
grant2stringThe read grant ExportHostSnapshot returned.
name3stringThe host's name, for progress reports.

ListHostSnapshotsRequest#

Request for HostSnapshotsService.ListHostSnapshots.

No fields.

ListHostSnapshotsResponse#

Response for HostSnapshotsService.ListHostSnapshots.

Field#TypeDescription
snapshots1repeated HostSnapshotThe snapshots, by name.
abis2repeated stringThe snapshot ABIs this host can restore.

ExportHostSnapshotRequest#

Request for HostSnapshotsService.ExportHostSnapshot.

Field#TypeDescription
name1stringThe checkpoint's name.
grant_ttl_secs2uint32How long the read grant lasts, in seconds (0: 3600; at most 86400).

ExportHostSnapshotResponse#

Response for HostSnapshotsService.ExportHostSnapshot.

Field#TypeDescription
snapshot1HostSnapshotThe snapshot.
manifest2bytesThe manifest (JSON). It holds the checkpoint's record, guest token included: pass it only to your own machines.
grant3stringA grant to read the snapshot's files from this host, until it expires.
path4stringPath of this host's snapshot files under its cua-spacesd address (/v1/snapshots), for SnapshotSource.url.
urls5repeated stringBase URLs this host serves the files on, as it knows its own addresses (its direct listener; each LAN address when it listens on all), for SnapshotSource.url. Empty: the host serves none (it is not set up with --direct); use the fallback.

PullHostSnapshotRequest#

Request for HostSnapshotsService.PullHostSnapshot.

Field#TypeDescription
manifest1bytesThe manifest from ExportHostSnapshot. Empty: read it from the fallback by name.
sources2repeated SnapshotSourceHosts that have the files, tried in order.
fallback3SnapshotFallbackWhere to fetch files no source could give.
name4stringThe snapshot's name, when manifest is empty.

PublishHostSnapshotRequest#

Request for HostSnapshotsService.PublishHostSnapshot.

Field#TypeDescription
name1stringThe checkpoint's name.
fallback2SnapshotFallbackWhere to publish it (required).

SnapshotSyncProgress#

Progress of a snapshot copy.

Field#TypeDescription
name1stringThe snapshot's name.
digest2stringIts digest.
from3stringWhere the files come from now: a host's name, s3 or volume (or, when publishing, where they go).
bytes_done4uint64Bytes copied so far.
bytes_total5uint64Bytes to copy in all (files already here are not counted).
bytes_reused6uint64Bytes not copied because this host had those files already.
done7boolThe last message: the copy is finished.
verified8boolEvery file's SHA-256 matched the manifest.

PullHostSnapshotResponse#

Response for HostSnapshotsService.PullHostSnapshot: one progress report.

Field#TypeDescription
progress1SnapshotSyncProgressThe copy's progress.

PublishHostSnapshotResponse#

Response for HostSnapshotsService.PublishHostSnapshot: one progress report.

Field#TypeDescription
progress1SnapshotSyncProgressThe upload's progress.

CreateHostSnapshotRequest#

Request for HostSnapshotsService.CreateHostSnapshot.

Field#TypeDescription
space1stringThe Space: its relay machine (relay:<machine> or the bare id), or its local:<name> on the host (a direct Space).
name2stringThe checkpoint's name (unique among the host's checkpoints and sandboxes).
pin3boolPin the new checkpoint.

CreateHostSnapshotResponse#

Response for HostSnapshotsService.CreateHostSnapshot.

Field#TypeDescription
snapshot1HostSnapshotThe new checkpoint.

DeleteHostSnapshotRequest#

Request for HostSnapshotsService.DeleteHostSnapshot.

Field#TypeDescription
name1stringThe checkpoint's name.

DeleteHostSnapshotResponse#

Response for HostSnapshotsService.DeleteHostSnapshot.

Field#TypeDescription
message1stringWhat happened, for people.