Snapshots are disk-only and require a sandbox that is not running (stopped or crashed).
listDir, reindex, save/saveTo, load, and verify keep the same API
on every backend, but currently reject with UnsupportedError in cloud.Capture and boot
These entry points live onSandboxBuilder and SandboxHandle; they are the bridge between sandboxes and snapshot artifacts.
.fromSnapshot()
Example
Example
.image(); the snapshot already pins the
image. Passing a Snapshot or SnapshotHandle preserves its backend-relative
reference automatically.
Parameters
snapshotstring | Snapshot | SnapshotHandleBackend-relative string or snapshot object returned by this SDK.
Returns
The same builder, for chaining.
handle.snapshot()
Parameters
namestringSnapshot name. Local stores it in the default snapshot directory; cloud creates a managed snapshot.
Returns
The created snapshot artifact.
Example
Example
Snapshot static methods
Snapshot.builder()
name through the active backend. With no
destination, local uses its default snapshot directory and cloud uses managed
storage. .destDir() selects a local parent or cloud host-volume
directory.
Parameters
namestringSnapshot name. Its storage location is selected by the active backend.
Returns
Builder for configuring the snapshot.
Example
Example
Snapshot.open()
Example
Example
verify() for content checks where supported.
Parameters
pathOrNamestringBackend-relative snapshot name, ID, or path.
Returns
The opened snapshot.
Snapshot.get()
Example
Example
SnapshotHandle.
Parameters
nameOrDigeststringPublic identifier understood by the active backend, such as a local name/digest or cloud snapshot ID.
Returns
Lightweight handle returned by the active backend.
Snapshot.list()
Example
Example
Returns
All indexed snapshot handles.
Snapshot.listDir()
UnsupportedError.
Parameters
dirstringDirectory to scan for artifact subdirectories.
Returns
Parsed snapshots found in the directory.
Snapshot.remove()
Example
Example
force is
set. In cloud, the string identifies a managed or host-volume snapshot.
Parameters
pathOrNamestringPath, name, or digest of the snapshot to remove.
opts.forcebooleanRemove even if the snapshot has indexed children. Defaults to
false.Snapshot.reindex()
Example
Example
UnsupportedError.
Parameters
dirstringDirectory to scan. Defaults to the configured snapshots dir.
Returns
Promise<number>
Count of artifacts indexed.
Snapshot.save()
.tar.zst archive. The recorded manifest is
archived as-is, so create the snapshot with
recordIntegrity() if receivers must verify content. See
SaveOpts for bundling options. Cloud returns
UnsupportedError.
Parameters
nameOrPathstringName or path of the snapshot to bundle.
outstringOutput archive path.
optsSaveOptsBundling options. All fields default to
false.Example
Example
Snapshot.load()
.tar.zst or .tar) into the local snapshots
directory. Structural and archive-entry checks run during import; recorded
payload integrity is preserved for explicit verify().
Compression is detected from magic bytes. Cloud returns UnsupportedError.
Parameters
archivestringPath to the archive to unpack.
deststringDestination directory. Defaults to the snapshots directory.
Returns
Handle to the loaded snapshot.
Example
Example
Snapshot instance members
ASnapshot represents a backend-neutral disk snapshot and retains the backend
that created or opened it. Returned by Snapshot.builder().create(),
Snapshot.open(), and handle.snapshot().
snap.reference
SandboxBuilder.fromSnapshot().
snap.referenceKind
reference. Most callers can pass the
snapshot object directly and never inspect this value.
snap.digest
sha256:hex). The snapshot’s identity.
snap.sizeBytes
snap.imageRef
snap.imageManifestDigest
snap.format
snap.scope
"disk" for a disk-only snapshot, "resumable" once resumable snapshots land. Always "disk" today. See SnapshotScope.
snap.fstype
"ext4").
snap.parent
null for a root.
snap.createdAt
snap.labels
[key, value] pairs.
snap.sourceSandbox
null when the manifest has no source recorded.
snap.saveTo()
UnsupportedError.
snap.verify()
Example
Example
upper.kind is "notRecorded" when no integrity was recorded. The cloud backend currently rejects this operation with UnsupportedError.
Returns
Verification result.
SnapshotBuilder
Fluent builder for a snapshot, returned bySnapshot.builder(name). Every setter mutates in place and returns this, so calls chain. The source sandbox is required: call .fromSandbox() before .create().
.fromSandbox()
.create() fails without it.
Parameters
sourceSandboxstringName of the stopped sandbox to capture.
.destDir()
destDir/<name>; the name stays the snapshot’s identity either way.
Parameters
destDirstringParent directory to create the artifact in (e.g. a larger volume).
.label()
key=value label to the snapshot manifest. May be called repeatedly.
Parameters
keystringLabel key.
valuestringLabel value.
.force()
.recordIntegrity()
.resumable()
"resumable" snapshot (disk plus VM state). Accepted by the builder, but .create() currently returns an Unsupported error; resumable snapshots have not landed yet.
.create()
Example
Example
Returns
The created snapshot artifact.
Types
SnapshotHandle class
Lightweight handle returned by the active backend. Values are snapshotted at construction time; callSnapshot.get() again for a fresh
reading if needed. Handles from Snapshot.list() are
read-only; fetch a live handle via Snapshot.get() for lifecycle methods.
Returned by Snapshot.get(), Snapshot.list(), Snapshot.load()
snapshotHandle.open()
Snapshot.list()); fetch a live handle via Snapshot.get() first.
snapshotHandle.remove()
force is set. Throws if this handle is read-only.
snapshotHandle.saveTo()
Snapshot.list() are metadata-only; fetch a live handle
with Snapshot.get() first. Cloud returns UnsupportedError.
SaveOpts interface
Bundle options forSnapshot.save() and instance saveTo() methods. All fields default to false.
Used by Snapshot.save() and instance saveTo() methods
SnapshotScope type
Scope of what a snapshot captures. Every snapshot today is"disk"; "resumable" (disk plus VM state) is reserved for resumable snapshots.
Returned by snap.scope · SnapshotHandle.scope
SnapshotVerifyReport union
Result ofsnap.verify(). The upper discriminant is "notRecorded" when no integrity hash was stored at create time, or "verified" when the recorded hash matched the recomputed one.
Returned by snap.verify()