Skip to main content
Manage local snapshot groups and immutable checkpoints. See the snapshot guide for workflows, cloud support and migration. Use ctx.snapshots().get(name) for a history and ctx.checkpoints().get(id) for one checkpoint. Both collections retain the selected provider. Cloud supports individual disk checkpoints. Spawning from an exact remote checkpoint requires a managed ID. An explicit host-volume path restore selects the contents currently at that path.

Sandbox capture

sandbox.snapshot()

Create a source-bound group and its first disk checkpoint with default capture options. Available on both Sandbox; an existing group is refused.

sandbox.snapshot_with()

Create a new group through a sandbox or sandbox handle, then capture later checkpoints through that group. The initial call refuses an existing group; an append uses its saved source identity. Imported or orphaned groups cannot capture, and recreating a sandbox with the same name does not rebind them.
Returns SnapshotCreateResult with the group, exact first checkpoint and publication-owned head outcome. Read that checkpoint when you need the artifact produced by this call; another capture may already have moved head. An omitted member name is generated. Full capture and integrity recording are explicit options.

Snapshot group methods

Snapshot::open()

Open an existing local history directory, including groups captured or imported outside the default snapshot store. Relative paths are anchored when the call is made, before deferred work; symlinks retain their filesystem meaning. The returned group retains its backend and path for later operations. Missing directories fail without creating a group or falling back to a same-name default-store group. Cloud backends do not support this local-directory operation. Use get (Get in Go) to select a bare group name from the default store.

Snapshot::get()

Open a named history, including a group with no selected head. Groups are local-only; cloud group operations return unsupported.

Snapshot::list()

List installed groups. Standalone artifacts are not invented into groups.

group.name()

Return the retained local history name.

group.head()

Read the selected checkpoint once, or return None after explicit clearing. The returned checkpoint retains its identity if the head changes later.

group.set_head()

Select an existing member by group-local name or stable ID. Selecting the current head returns a no-op HeadUpdate.

group.clear_head()

Clear selection while preserving every member. Clearing an already empty selection reports a no-op. Use an exact checkpoint to spawn from a headless group.

group.checkpoints()

List immutable members in stable ID order, including when the group has no head.

group.get_checkpoint()

Open an exact member by group-local name or stable ID without changing head.

group.checkpoint()

Capture the bound source using a generated member name and default disk-only capture policy.

group.checkpoint_with()

Capture the bound source with SnapshotCaptureOptions; return CheckpointCaptureResult with the exact checkpoint and its publication-owned head outcome. Imported or orphaned groups refuse capture; a same-name replacement sandbox does not rebind them. One sandbox may have several groups, but each group binds one sandbox instance. An existing group’s destination cannot be changed by capture options.

Snapshot::load()

Import an archive set into a named history using default options. See load_with() for publication and result semantics.

Snapshot::load_with()

group is a name and files is &[PathBuf]. The callback receives SnapshotImportOptions, with destination/base/head controls and no second group selector. Legacy artifact-loading methods retain LoadOpts and its optional group field. Returns SnapshotImportResult: snapshot, checkpoints, added, reused, head_update, operation_id, and warnings. The result contains every unique supplied checkpoint, including bundled dependencies, in stable ID order. added and reused identify what was new versus already installed at publication; archive argument order does not select the head. The head outcome belongs to this operation and does not change when another operation edits the group. Multiple incomparable tips can commit a headless group; explicit head selection refuses ambiguous tips. A successful return confirms publication and catalog completion. Warnings describe deferred cleanup after commit. A structured import error distinguishes no publication, confirmed publication with a later failure, and an unknown outcome needing recovery. Import never binds a group to a source sandbox. See atomic import requirements for filesystem capabilities and maintenance requirements.

group.inspect()

Returns the group’s name, backend path, optional head, member count and optional saved source binding. Head and count come from one protected metadata read. Field names include checkpoint_count, source.recorded_name, source.current_name, source.database_uuid, source.sandbox_id. The source is absent for an unbound history; otherwise its SnapshotSourceStatus is Available, MissingSandbox or DifferentCatalog. Saved and current names distinguish renames; identity is the catalog UUID plus sandbox row ID, so deleting and recreating the same name does not rebind the group. Source availability is observed separately from group metadata and is not a guarantee of later capture readiness. Inspection does not change the selected head or create a missing catalog identity. Invalid metadata and database failures remain errors, rather than being reported as unbound. Obtain a member with get_checkpoint for its immutable metadata.

group.verify()

Checks every pinned member and returns SnapshotGroupVerifyReport. Its state distinguishes Complete, Incomplete, Invalid, and Empty; checkpoints preserves each member’s identity, path, optional existing SnapshotVerifyReport, and findings. payload_hashes counts physical payload hash passes, deduplicated per algorithm. Headless groups are valid, while empty groups report zero checked. To check only head, obtain group.head() and verify that checkpoint. Missing checksums return explicit incomplete coverage. Corruption, missing files, unsupported required features, and operational failures return MicrosandboxError::SnapshotVerification(report) when a meaningful group report exists; failures before selection return the ordinary SDK error. Inspect the attached report without treating the failed call as success. Selected payloads stay reader-pinned until verification finishes, including after caller cancellation. Same-group captures, imports and head changes wait for hashing to finish. Concurrent older removers must be stopped or upgraded; reads and sandbox execution can continue.

group.remove()

Removes the selected history and returns SnapshotRemoveResult with group, removed, head_update, and warnings. The member IDs and cleared-head outcome belong to this operation. Empty groups can be removed. Active readers and surviving external dependents refuse removal; there is no force bypass for an entire group. If publication commits but catalog cleanup fails, the call raises or returns MicrosandboxError::SnapshotGroupRemovalRecovery { result, source }. The attached result means removal already happened. Cleanup warnings after successful catalog reconciliation are returned in the result. An uncertain durability outcome is an error requiring recovery rather than a claimed successful removal. Later listing recovers pending cleanup without deleting a replacement group.

group.spawn_sandbox()

Group spawn selects head once and retains that member while preparing the destination. An unselected head fails. Full checkpoints resume execution by default; disk checkpoints boot fresh. Destination callbacks use RestoreBuilder and cannot replace the selected source. See destination options.

group.spawn_sandbox_with()

Configure destination options for the selected head.

group.spawn_sandbox_with_progress()

Local-only. Returns a progress handle and a result task. Await the result task to observe the sandbox or creation error; receiving progress is not completion. The configured variant accepts the same destination options as spawn_sandbox_with().

group.spawn_sandbox_with_progress_with()

Local-only. Returns a progress handle and a result task. Await the result task to observe the sandbox or creation error; receiving progress is not completion. The configured variant accepts the same destination options as spawn_sandbox_with().

SnapshotSourceRecoveryError

A failed capture can still have published its requested artifact before source recovery failed. SnapshotSourceRecoveryError preserves the source checkpoint recovery locator and, when publication completed, the published artifact’s kind, path, identity, digest and head_update. The head outcome belongs to that publication even if another operation changes the group afterward. Archive-only capture and older producers omit it; do not infer it by reading the current head. Inspect those details before retrying or removing the source. The error does not prove that the source is running or safely paused.

Static methods

Checkpoint::local()

Select the default-local destination. Requires the local feature. Does not consult remote selection variables. See selector examples.

Checkpoint::remote()

Capture remote environment credentials and endpoint without network I/O. Requires the cloud feature. Missing credentials fail; existing resources keep their destination. See selector examples.

Checkpoint::builder()

Configure a snapshot. Set the required source with from_sandbox(); see SnapshotBuilder for options.

Parameters

nameimpl Into<String>
Member name; generated when empty. Names must not contain path separators or start with ..

Returns

Builder for configuring the snapshot.

Checkpoint::create()

Create an installed snapshot artifact atomically, then best-effort update the rebuildable local index. Locally, disk mode supports running, paused, stopped, and crashed sources; full mode includes memory and execution state from a running or paused source. Cloud supports only disk capture from a stopped persistent source. Most callers use the builder’s create() instead of constructing a SnapshotConfig by hand.

Parameters

Name, source sandbox, labels, and integrity flag.

Returns

The created artifact handle.

Checkpoint::create_archive()

Capture a disk or full snapshot directly into an archive without installing it locally.

Checkpoint::open()

Open an existing artifact by group head, group:member, or path. This is a fast metadata operation: it verifies the manifest structure, recomputes the manifest digest, and checks that the upper file exists with the recorded size. It does not read the full upper contents; use verify() for that.
For the local backend, relative artifact paths are resolved when the operation begins, and the returned snapshot retains that absolute location. Changing the process working directory later does not retarget an opened or listed snapshot. Local import, export, copy, and capture destinations are also resolved before asynchronous work starts. Group names and snapshot IDs continue to resolve through the snapshot store.

Parameters

path_or_nameimpl AsRef<str>
Group head, group:member, or filesystem path to an artifact directory.

Returns

The opened artifact handle.

Checkpoint::open_ref()

Open a snapshot from an explicit SnapshotReference. Use this when passing through a reference returned by another SDK operation; it preserves whether the backend should resolve the value as an identifier or a path.

Checkpoint::get()

Look up a lightweight Checkpoint by group head, group:member, stable snapshot ID, descriptor digest, or artifact path. Global IDs and digests must resolve unambiguously.

Parameters

name_or_digest&str
Group head, group:member, stable snapshot ID, descriptor digest, or artifact path.

Returns

Handle backed by the matching index row.

Checkpoint::list()

List snapshots from the active backend. Locally this uses the local index; in cloud it paginates through managed snapshots. Host-volume artifacts are not included automatically.

Returns

Indexed snapshot resources, ordered by creation time descending.

Checkpoint::list_dir()

Walk a directory and parse each subdirectory’s manifest. Does not touch the index. Skips entries that don’t look like snapshot artifacts (no snapshot.json) and malformed artifacts.

Parameters

dirimpl AsRef<Path>
Directory to scan for artifacts.

Returns

One handle per valid artifact found.

Checkpoint::remove_by_reference()

Remove a snapshot artifact by group selector, unambiguous ID or digest, or path, along with its index row. Refuses if the snapshot has indexed children unless force is set. When you remove the head, its surviving same-group parent becomes the new head. If it has no such parent, the group has no selected head.

Parameters

path_or_name&str
Group head, group:member, unambiguous snapshot ID or digest, or artifact path.
forcebool
When true, remove even if the snapshot has indexed children.

Checkpoint::remove_ref()

Use a typed reference obtained from checkpoint.reference(). For a path or name, use remove_by_reference().

Checkpoint::reindex()

Rebuild the local snapshot index from artifacts in dir.

Parameters

dirimpl AsRef<Path>
Directory of artifacts to index.

Returns

usize
Number of artifacts indexed.

Checkpoint::reindex_default()

Rebuild the local snapshot index from the configured default snapshot directory. This is equivalent to reindex() with the local backend’s configured store and returns MicrosandboxError::Unsupported on backends without a rebuildable artifact index.

Checkpoint::save_by_reference()

staticasync
Bundle a snapshot into a .msb archive (or plain .tar) at out. Recorded payload integrity is preserved but not executed implicitly; call verify() when an independent content scan is part of your workflow. See SaveOpts to also include ancestors and the OCI image cache.

Parameters

name_or_path&str
Group head, group:member, or artifact path to save.
out&Path
Output archive path. Parent directories are created if missing.
Bundling options. SaveOpts::default() writes the head snapshot only, zstd-compressed.

Checkpoint::load()

staticasync
Unpack a snapshot archive (.msb or .tar, detected from magic bytes) into the snapshots directory (or dest), routing any bundled image-cache entries into the global cache and registering everything found in the index. Structural and archive-entry checks remain mandatory, while recorded payload integrity is preserved for explicit verify(). Returns a handle for the head snapshot.

Parameters

archive_path&Path
Archive to unpack.
destOption<&Path>
Destination directory. None uses the default snapshots directory.

Returns

Handle for the archive-declared head snapshot, which may differ from the receiving group’s selected head.

Instance methods

Methods on an opened Checkpoint artifact.

Checkpoint::load_with_base()

Import an archive with an explicit dependency base or destination group. See import options.

Checkpoint::load_with_options()

Import an archive with an explicit dependency base or destination group. See import options.

Checkpoint::load_many()

Import archives as one batch. Returns handles in input order. Dependencies resolve from the batch, the named group, or an explicit base; input order does not matter. All members are validated before publication.

Checkpoint::group_head()

Read the selected ID from a local group, or explicitly set it to an installed member’s stable ID. A headless group returns an absent ID. A missing group or qualified group name raises an error. The write returns the previous and current IDs, reason and change flag. See group selection.

Import options

Options for LoadOpts. With divergent tips, the existing head stays selected; a new group has no head. Select a member explicitly. Identical members may be reused; conflicting identities fail. See archive imports.

Instance methods

snap.destroy()

Delete the captured snapshot through its retained context. Local deletion checks the descriptor identity under the deletion lease; managed remote snapshots use the captured resource ID. Remote path snapshots return Unsupported until the provider supports atomic conditional deletion. force does not bypass identity checks or enable unsafe path deletion. Explicit path-selected removal remains available through Checkpoint::remove_ref(...) and context collections.

snap.id()

Stable opaque identity captured at selection time; older catalog entries may use a descriptor digest. Copying, archiving, or relabeling the snapshot preserves this value.

snap.digest()

SHA-256 digest of the canonical descriptor bytes. This detects descriptor conflicts but is separate from the stable snapshot ID.

Returns

&str
Manifest digest in sha256:hex form.

snap.reference()

Backend-neutral locator that preserves whether the snapshot is addressed by an identifier or path. Use it with dedicated restore and lifecycle methods without assuming client-host filesystem access.

Returns

SnapshotReference
Typed backend-relative snapshot reference.

snap.state()

Load current descriptor metadata and return its state. The lookup validates the captured descriptor identity; missing or replaced artifacts return errors.

snap.labels()

Fetch current mutable labels. No stale fallback is returned if loading fails.

snap.manifest()

An owned, freshly loaded Manifest, validated against the captured descriptor identity: stable identity, state closure, capture provenance, pinned image, parent identity, and extensions. Mutable labels are exposed by labels() and are not part of this descriptor.

Returns

Parsed snapshot manifest.

snap.size_bytes()

Backend-reported stored payload size. This is the apparent upper-file size for local and host-volume artifacts, and the stored archive size for managed cloud snapshots.

Returns

u64
Upper-layer apparent size in bytes.

snap.path()

Return the local artifact directory. Cloud snapshots return MicrosandboxError::Unsupported because managed and host-volume artifacts are not paths on the client host. Use reference() for backend-neutral restore and lifecycle operations.

snap.save_to()

Bundle this snapshot into an archive using the backend retained when it was created or opened. This avoids re-resolving its reference through the current default backend. Artifact archives are currently local-only; other backends return MicrosandboxError::Unsupported.

snap.copy_to()

Create a new archive from this snapshot’s disk data while replacing its labels and integrity metadata. The source snapshot is unchanged. Artifact copies are currently local-only; other backends return MicrosandboxError::Unsupported when save() is awaited.

snap.verify()

Verify the snapshot’s complete state closure. File state recomputes recorded upper-layer integrity and returns NotRecorded without reading the payload when integrity is absent. Checkpoint state validates the root, manifests, disk layers, device/execution objects, and every referenced memory object, then returns the verified checkpoint root.

Returns

Digest, path, and upper-layer verification status.

snap.name()

Member name within its group, or None when no alias is recorded.

snap.parent_digest()

The captured parent snapshot’s stable ID, or None when no parent is known. The accessor retains its existing parent_digest name.

snap.image_ref()

Image reference the snapshot was taken from.

snap.format()

On-disk format of the upper layer.

Returns

Upper-layer format (Raw today).

snap.created_at()

Checkpoint creation time, parsed from the manifest.

checkpoint.save()

The receiver selects one immutable checkpoint. Use the group’s optional head or exact-member lookup first; saving a group’s whole history is not implied. The no-options call writes a compressed .msb archive. save_to retains its explicit options form for compatibility. See the archive compatibility option before sending output to an older reader.

checkpoint.save_with()

Configure archive options for this exact checkpoint. See SaveOpts.

checkpoint.remove()

To migrate Snapshot::remove(reference, force), use Checkpoint::remove_by_reference(reference, force). When you already hold the checkpoint, checkpoint.remove() returns its removal result and checkpoint.destroy(force) returns success or failure.
These are alternative calls, not successive removals of the same checkpoint. The instance method removes the retained checkpoint identity, refuses a replacement at the same address, and returns CheckpointRemoveResult with id, optional head_update, and warnings. The head outcome belongs to this operation; later head edits do not change it. Removing the head selects its surviving same-group parent or clears selection. Removing another member reports an unchanged head. Standalone artifacts have no head outcome. Force permits removal despite indexed children, but never bypasses reader protection. A repeated removal reports a missing checkpoint rather than fabricating another successful result. Backends or native libraries without exact-removal reporting return unsupported instead of falling back to deletion by name. If removal commits but catalog cleanup fails, the call returns MicrosandboxError::SnapshotRemovalRecovery { result, source }. Its result is authoritative: removal already happened. Recover the affected storage before retrying cleanup; do not assume an error means the checkpoint still exists.

checkpoint.remove_with()

Configure exact removal with CheckpointRemoveOptions. Force never bypasses active-reader protection.

checkpoint.spawn_sandbox()

Resume this checkpoint in a new sandbox. A later head change leaves this selection intact. Disk checkpoints boot a fresh VM.

checkpoint.spawn_sandbox_with()

Configure the destination using the restore options. The receiver selects the source checkpoint.

checkpoint.spawn_sandbox_with_progress()

On a local provider, receive progress events and await the result task for the sandbox or creation error.

checkpoint.spawn_sandbox_with_progress_with()

Configure the destination and receive local creation progress. Await the result task even if you skip the events.

SnapshotBuilder

Builder for a SnapshotConfig. Obtained via Checkpoint::builder(name). A source sandbox is required (from_sandbox); the other setters are optional. Every setter returns Self, so calls chain.

.from_sandbox()

builder
Set the sandbox to capture. Required; build() and create() fail without it.

Parameters

source_sandboximpl Into<String>
Name of the OCI-rooted source sandbox. Local disk capture also supports running and paused sources. Cloud requires a stopped persistent source.

.group()

Set the local snapshot group. Defaults to the source sandbox’s name. Direct archive capture does not accept a group.

.dest_dir()

builder
Create the snapshot group under this parent directory instead of the default snapshots store. Member names are local aliases within the group; stable snapshot IDs identify immutable artifacts.

Parameters

dest_dirimpl Into<PathBuf>
Parent directory to create the artifact in (e.g. a larger volume).

.label()

Add a user label. Can be called multiple times. Labels are sorted by key in the manifest’s canonical form.

Parameters

keyimpl Into<String>
Label key.
valueimpl Into<String>
Label value.

.force()

Overwrite an existing direct archive output file. Installed group members are immutable, so installed creation rejects this option.

.record_integrity()

Compute and record sparse-aware BLAKE3 Merkle integrity during creation. verify() checks it explicitly; ordinary open, boot, save, load, and upgrade preserve the value without adding an independent payload pass.

snapshot_builder.full()

builder
Local-only: capture disk, memory, and execution state. The source must be running or paused and returns to that state after capture.

.guest_flush()

Select guest writeback before capture. Defaults to GuestFlush::Auto; see guest writeback.

.build()

Materialize the SnapshotConfig without creating the snapshot. Errors with InvalidConfig if from_sandbox was not called. For capturing, use create instead; it calls build internally.

Returns

Validated snapshot configuration.

.create()

Build and execute the snapshot in one step. Equivalent to Checkpoint::create(self.build()?).

Returns

The created artifact handle.

SnapshotCopyBuilder

Returned by Checkpoint::copy_to(). It reuses the source disk data while replacing explicit-snapshot metadata in a new archive.

Forking

Fork a running or paused local sandbox to create a child with copy-on-write memory. The source returns to its previous state, and each child needs an unused name. Sandbox has the same methods. See the forking guide for backend limits and disk bindings.

fork()

Build one child from the current execution state; call .fork().await to start it.

fork_many()

Capture once for all names and return outcomes in input order. Each ForkOutcome has a name and a result for that child. Validation or capture errors fail the outer call; a child startup error leaves successful siblings running. Stop successful children when finished. The builders support .record_integrity(), .guest_flush(GuestFlush::Required), and .volume() for rebinding captured disks. Forks cannot add new block devices, and batch children cannot share a writable disk image. See fork disk bindings. The single-child builder also exposes .fork_with_progress() with the local feature. Import GuestFlush from microsandbox::snapshot; see guest writeback for the policy. ForkOutcome.name is a String; ForkOutcome.result is a MicrosandboxResult<Sandbox>. branch(), branch_many(), the builder .branch() terminal, .branch_with_progress(), and the BranchBuilder, BranchManyBuilder, and BranchOutcome types remain deprecated aliases.

RestoreBuilder

Restore into a new detached sandbox. Disk boots fresh; full resumes execution. See restore examples and progress.

restore.cow_memory()

Share unchanged full-snapshot memory.

restore.forked()

Deprecated alias for the same CoW memory policy; see migration notes.

restore.disk_only()

Boot only the saved disk.

restore.snapshot_base()

Supply an archive dependency.

restore.restore()

Return the restored sandbox.

restore.restore_with_progress()

Return the progress receiver and result task.

restore.init()

Select guest PID 1 for disk boot. Accepts an absolute guest executable path or "auto". Full-memory resume rejects an explicit choice, including "auto"; use disk_only() to boot the captured disk with a new init.

restore.init_with()

Set init arguments and environment using the same builder as ordinary creation. Replaces an earlier init choice. Available on group and checkpoint spawn callbacks, including progress variants.

restore.hostname()

Set a nonempty guest hostname of at most 64 UTF-8 bytes for disk boot. Full-memory resume refuses replacement even when the requested name matches the source. Image, replacement, and automatic startup-command options are not accepted; entrypoint/CMD configure future commands only. Full restore requires matching CPU and memory settings, keeps captured network devices, and cannot apply a new guest security profile. Use disk-only restore to change these. Restore rejects missing external filesystems (and, for full restore, additional disks) by default. Use allow_missing_resources() to resume with unavailable devices (full restore records warnings). This is separate from strict/relaxed validation of supplied mappings; inheritance does not waive missing backing. Root and owned storage remain required.

restore.cpus()

CPU count and memory in MiB. Full restore must match capture.

restore.memory()

CPU count and memory in MiB. Full restore must match capture.

restore.max_cpus()

Set the maximum possible CPU count for a disk boot. Must be positive and at least the requested CPU count. Full-memory resume requires the captured ceiling exactly.

restore.max_memory()

Set the memory ceiling in MiB for a disk boot. Must be positive and at least the requested memory. Full-memory resume requires the captured ceiling exactly. Omitting either ceiling retains the existing inherited/default choice.

Destination command defaults

Use workdir, shell, entrypoint, cmd, env and envs to configure new commands in the destination. They work for disk boots and full resumes without changing captured processes or starting a workload during restoration. An explicit empty entrypoint or CMD clears that default; omission keeps existing resolution. Environment defaults combine with per-command overrides through the ordinary SDK rules. Guest working directories must exist. These are explicit destination settings, not automatically saved snapshot configuration. Unsupported native bindings reject new explicit options before dispatch.

restore.label()

Attach a destination sandbox label. An existing key is replaced; source snapshot labels remain unchanged. Normal sandbox label validation applies.

restore.labels()

Attach several destination labels with the same semantics as label().

restore.network_policy()

Replace host traffic filtering; guest DNS and TLS settings stay unchanged.

restore.pull_policy()

Control retrieval of the snapshot’s recorded image digest. The default if-missing and explicit never can use complete local/archive content offline. always revalidates that exact digest through its registry, even when cached, and fails if the registry cannot provide it. This never follows the original mutable tag or changes the source snapshot.

restore.proxy()

Select the destination host proxy before disk boot or full-memory resume. This preserves the captured guest interface and does not inject guest trust material. SOCKS5 passwords use destination environment references; resolved passwords are not saved in snapshot configuration.

restore.max_connections()

Concurrent TCP limit; zero means unlimited.

restore.disable_network()

Remove the NIC. Rejected for full snapshots that captured one.

restore.security()

Guest security profile. Disk boot only, including an explicit default profile.

restore.guest_clock()

Override the snapshot’s clock setting with Sync or Off. Supports full restores.

restore.max_duration()

Lifetime and idle limits. Omitted means unlimited; zero expires immediately.

restore.idle_timeout()

Lifetime and idle limits. Omitted means unlimited; zero expires immediately.

restore.port()

Bind destination TCP or UDP ports.

restore.port_bind()

Bind destination TCP or UDP ports.

restore.port_udp()

Bind destination TCP or UDP ports.

restore.port_udp_bind()

Bind destination TCP or UDP ports.

restore.vsock()

Bind destination vsock endpoints.

restore.vsock_dgram()

Bind destination vsock endpoints.

restore.user()

Default user for new execs and host runtime log level.

restore.log_level()

Default user for new execs and host runtime log level.

restore.dangerously_inherit_resources()

Explicitly inherit host resources. Disabled by default.

restore.external_mount_policy()

Validate supplied filesystem mappings: strict (default) or relaxed. Does not grant access.Omitted controls retain destination defaults. Durations are whole seconds. Network policy accepts NetworkPolicy. Use |v| v.captured() for a private captured volume.

restore.volume()

Map a host volume to a guest path, or use |v| v.captured() to select its captured private volume.

restore.allow_missing_resources()

Allow unavailable external filesystems or additional disks. Full restore records warnings; root and owned storage remain required. Disabled by default. This does not relax validation of supplied mappings.

Sandbox::restore_ref()

Restore from an explicit backend-neutral snapshot reference. Pass a Checkpoint or Checkpoint reference without reinterpreting an identifier as a path. This uses the same dedicated restore options and backend capability checks as Sandbox::restore().
See sandbox capture for Sandbox group creation. Both retain the receiver’s backend and stable sandbox identity.

Compaction

Compact a local sandbox’s root or owned disks. See compaction for examples and recovery requirements.

compact.disk()

Select one owned disk by guest path; / selects the root.

compact.root_disk_only()

Select only the root. Cannot combine with the disk selector.

compact.layers()

Oldest sealed layers to merge, including the base. Minimum two; omit for all. Excludes the writable layer.

compact.dry_run()

Preview without changing storage.

compact.apply()

Compact the selected disks and return aggregate and per-disk results. Defaults to the root and owned data disks; excludes named/external volumes and directories. Requires a running or fully stopped local sandbox. Fewer than two sealed layers means no change; no eligible disks returns an empty result with zero counts. Results include aggregate counts and per-disk entries keyed by guest_path. materialized_bytes counts copied bytes, not reclaimed space. Times are microseconds: per-disk total_us covers preparation; aggregate total_us also includes switching; pause_us measures the shared VM pause.

Types

SnapshotCreateResult

snapshotSnapshot
Created history, bound to the source sandbox’s stable identity.
checkpointCheckpoint
Initial immutable member, even if another capture has since advanced the head.
head_updateHeadUpdate
Head outcome recorded by this capture operation.

CheckpointCaptureResult

checkpointCheckpoint
The exact captured member.
head_updateHeadUpdate
Whether and why this operation advanced the head.

SnapshotImportResult

operation_idString
Identifier for this import attempt, also carried by structured import errors.
snapshotSnapshot
Destination history, including when it has no selected head.
checkpointsVec<Checkpoint>
Every unique member supplied by the batch, including bundled dependencies, in ID order.
addedVec<SnapshotId>
Members newly installed by this operation, in ID order.
reusedVec<SnapshotId>
Identical members already installed at commit time, in ID order.
head_updateHeadUpdate
Head decision made by this operation, including ambiguous headless imports.
warningsVec<String>
Cleanup still needed after a confirmed successful commit.

SnapshotGroupInfo

nameString
Selected group’s name.
pathPathBuf
Group location in the backend’s filesystem, not a client-relative path.
headOption<SnapshotId>
Selected checkpoint, including an explicitly headless history.
checkpoint_countu64
Number of installed members observed with this head.
sourceOption<SnapshotSourceBinding>
Local capture association; absent for unbound/imported histories.

SnapshotSourceBinding

database_uuidString
Catalog instance that owns the recorded sandbox row.
sandbox_idi32
Stable row identity within that catalog, never resolved by its display name.
recorded_nameString
Sandbox name when this association was recorded.
current_nameOption<String>
Current name of the same sandbox instance, when available.
statusSnapshotSourceStatus
Whether the recorded source still belongs to this catalog and exists.

SnapshotRemoveResult

groupString
Removed group’s name.
removedVec<SnapshotId>
Exact member identities removed, in stable order.
head_updateHeadUpdate
This operation’s head removal, including an already-headless group.
warningsVec<String>
Recoverable cleanup remaining after confirmed publication.

CheckpointRemoveResult

idSnapshotId
Immutable identity removed by this operation.
head_updateOption<HeadUpdate>
Group head decision; absent only for a standalone artifact.
warningsVec<String>
Removal committed, but these cleanup steps remain recoverable.

SnapshotGroupVerifyReport

groupString
Selected group name.
stateSnapshotVerificationState
Aggregate status; an empty group is not a verified checkpoint.
checkpointsVec<CheckpointVerification>
All selected members, in stable directory-name order, including malformed members.
payload_hashesusize
Physical payload hash passes; shared hard links use one pass per required algorithm.

CheckpointVerification

idOption<SnapshotId>
Stable member identity, if the directory name or descriptor provided a valid identity.
pathPathBuf
Selected member directory.
stateSnapshotVerificationState
Complete, incomplete or invalid; members never have the group’s empty state.
reportOption<SnapshotVerifyReport>
Existing artifact report when all recorded checks succeeded, even if coverage is incomplete.
findingsVec<SnapshotVerificationFinding>
Every observed failure or missing checksum, including shared dependency failures.

SnapshotVerificationFinding

pathPathBuf
File or member whose verification could not complete.
kindSnapshotVerificationFindingKind
Machine-readable reason, independent of the human diagnostic.
detailString
Diagnostic explaining the failed check.

HeadUpdate

groupString
Local group name.
previousOption<String>
Previously selected stable snapshot ID, if the group had a head.
headOption<String>
Stable snapshot ID selected after the operation, or none for a cleared head.
reasonHeadUpdateReason
Explanation for advancing or retaining the selected head.
changedbool
Whether the selected head changed.

SnapshotReference

enum
A backend-neutral snapshot locator. Obtain one from Checkpoint::reference() or Checkpoint::reference() and pass it to Sandbox::restore_ref(), Checkpoint::open_ref(), or Checkpoint::remove_ref(). This preserves whether a value is an identifier or a path without exposing the selected backend.
Auto(String)
Compatibility string interpreted automatically by the active backend
Id(String)
Identifier resolved by the selected backend
Path(String)
Path in the selected backend’s filesystem namespace
Use SnapshotReference::auto(), id(), or path() to construct a reference. value() returns the underlying string and kind() returns auto, id, or path.

Checkpoint

See handle methods for metadata access and lifecycle operations. A handle retains its selected backend; callers do not need to interpret the storage location.

SnapshotConfig

Inputs to create a snapshot. A type alias for SnapshotSpec. Usually built via SnapshotBuilder rather than constructed directly.

SnapshotFormat

On-disk layer representation. A checkpoint can contain a chain of raw and qcow2 layers; full execution-state metadata is represented separately.
Raw
Raw ext4 image, sparse on disk
Qcow2
qcow2 with an optional backing chain

SnapshotScope

enum
Checkpoint payload scope. Parsing accepts every known scope so older runtimes can still list and inspect artifacts they cannot restore; create and restore paths enforce support. Re-exported as microsandbox::snapshot::SnapshotScope.
Disk
Disk-only snapshot; captures the writable filesystem state
Full
Disk plus memory, execution, device, and admitted resource state

SaveOpts

struct
Options for Checkpoint::save_by_reference() and instance save_to() methods. Implements Default; SaveOpts::default() writes the selected checkpoint without walking its parents, zstd-compressed.
compatibilityArchiveCompatibility
Current (default) or V0_7_8; selects archive metadata and required-capability compatibility, without rewriting checkpoint identity
with_parentsbool
Walk the parent chain and include each ancestor in the archive
with_imagebool
Bundle the OCI image artifacts (EROFS layers, fsmeta, VMDK descriptor) from the global cache so the archive boots offline
plain_tarbool
Skip zstd compression and write a plain .tar. Default: zstd
sinceOption<String>
Omit disk layers and RAM objects supplied by an exact base. Mutually exclusive with last_layers and with_parents. Full checkpoint metadata remains complete.
last_layersOption<usize>
Include the newest N sealed disk layers. Loading omitted dependencies requires a base; memory, execution and device objects remain complete.

SnapshotVerifyReport

Result of explicit snapshot verification.
digestString
Checkpoint manifest digest
pathPathBuf
Artifact directory
Upper-layer result; retained as NotRecorded for checkpoint state
checkpointOption<CheckpointVerifyStatus>
Verified checkpoint root for full state
coverageSnapshotVerifyCoverage
Complete or Incomplete { unrecorded: Vec<PathBuf> }; includes every required disk payload

UpperVerifyStatus

Upper-layer content verification result.
NotRecorded-
No content integrity descriptor was recorded in the manifest
Verified- algorithm: String
- digest: String
Recorded integrity matched the computed digest

Manifest

The snapshot artifact descriptor, serialized as snapshot.json (DESCRIPTOR_FILENAME) and re-exported as microsandbox::snapshot::Manifest. Its SHA-256 digest is computed over RFC 8785 canonical JSON. Stable lineage identity is the separate snapshot_id field.
schemaString
Exactly microsandbox.snapshot/1
snapshot_idSnapshotId
Stable opaque snapshot identity
File or checkpoint state family
stateSnapshotState
Closed file-layer or checkpoint representation
captureSnapshotCapture
Immutable capture time, lineage, source checkpoint, and consistency
Image the snapshot was taken from
parentOption<SnapshotId>
Logical parent identity, or None for a root
requiresVec<String>
Sorted must-understand extension names
extensionsBTreeMap<String, Value>
Namespaced additive descriptor fields

ImageRef

Reference to the OCI image the snapshot was taken from. Re-exported as microsandbox::snapshot::ImageRef.
referenceString
Human-readable image reference (e.g. docker.io/library/python:3.12)
manifest_digestString
Digest of the OCI manifest, in sha256:hex form

DiskLayer

One member of the complete oldest-first file-layer closure. Re-exported as microsandbox::snapshot::DiskLayer; UpperLayer remains a source-compatibility alias.
layer_idDiskLayerId
Stable opaque physical-member identity
formatSnapshotFormat
raw or qcow2
virtual_sizeu64
Guest-visible size in bytes
backingOption<DiskLayerId>
Immediate predecessor; raw layers cannot have one
payload.file_kindLayerFileKind
regular
payload.integrityOption<UpperIntegrity>
Optional content integrity descriptor; None on local hot paths

UpperIntegrity

Content integrity descriptor for the captured upper layer.
Sha256sha256
Fields: digest. Exact released compatibility
SparseSha256V1msb-sparse-sha256-v1
Fields: digest. Exact released sparse-SHA compatibility
FileMerkleBlake3V1msb-file-merkle-blake3-v1
Fields: root, logical_size, leaf_size. Current opt-in sparse-aware integrity

SnapshotCaptureOptions

capture.initial_checkpoint()

Set the first checkpoint’s member name when creating a group.

capture.name()

Set the captured member name. Omission generates a name.

capture.full()

Capture memory and execution state as well as disk. Default capture is disk-only.

capture.record_integrity()

Record payload integrity checksums for later verification.

capture.guest_flush()

Use .guest_flush(GuestFlush::Required) on snapshot, fork, or fork-many builders, or source.pause_with_guest_flush(GuestFlush::Required). Import GuestFlush from microsandbox::snapshot. The default Auto flushes live disk-only captures, but adds no optional flush to full captures, forks, or pause. Skip retains mandatory storage barriers. A paused disk capture needs a matching prior flush; cloud rejects non-Auto policies. See guest flush policy reference.

capture.label()

Add a checkpoint label.

capture.dest_dir()

Set the store root when creating a new group. Existing group capture refuses a destination override.

SnapshotImportOptions

import.dest_dir()

Choose the group-store root. Omission uses the configured local snapshot store.

import.base()

Supply an explicit base group or archive for dependencies omitted from the input archives.

import.set_head()

Select the unique imported tip even if it diverges from the current head. Ambiguous tips fail; omission preserves the normal fast-forward/headless policy.

import.maximum_disk_bytes()

Limit total logical file bytes, including metadata, dependencies, and sparse holes. Each declared file disk must also fit. The limit must be positive; omission means unlimited. LoadOpts supports the same field and builder method. Temporary staging may need additional disk space.