Image materialization and snapshot artifacts
Image materialization turns an OCI image or a local image archive into cacheable filesystem artifacts that a sandbox can boot. It keeps the image's layer model for fast read-only use, and can also build one writable flat root filesystem. Snapshot and checkpoint artifacts then preserve a sandbox's writable or resumable state while pinning the exact image lineage that it needs. See Images and snapshots and Checkpoint and restore for the wider product view.
Materialization model
Input and output boundary
The image system accepts image references from registries and Docker or OCI layout archives. Both paths converge on the same layer records, file trees, and filesystem artifact stages. Registry pulls can use layered, flat, or all materialization; the default is layered (crates/…/pull.rs• L26-39).
The cache separates mutable image-reference metadata from immutable materialized content. Per-layer EROFS files are keyed by uncompressed layer identity, while fsmeta, VMDK, and flat references are tied to the resolved manifest or its derivation. Operation-scoped leases keep the exact metadata and artifact set live through catalog publication (crates/…/store.rs• L60-108, crates/…/lease.rs• L14-81, crates/…/storage_lease.rs• L18-24).
The main outputs have different jobs:
| Output | Purpose |
|---|---|
| Per-layer EROFS image | Stores one immutable layer in a form that can be reused by many images. |
fsmeta EROFS image | Describes the merged root tree and points regular-file data to layer images. |
| VMDK descriptor | Presents fsmeta and the layer images as one read-only virtual disk. |
| Flat ext4 image | Stores the merged tree and file data in one reusable raw root filesystem. |
| Snapshot artifact | Stores writable sandbox state plus the pinned base-image identity. |
| Checkpoint closure | Stores resumable guest state as a manifest plus immutable content objects. |
The layered and flat forms share the per-layer materialization stage. This lets a later request build a missing flat image from cached EROFS layers without downloading the image again (crates/…/client.rs• L288-376, crates/…/flat.rs• L27-112).
References: crates/…/pull.rs• L26-39 crates/…/store.rs• L60-108 crates/…/lease.rs• L14-81 crates/…/storage_lease.rs• L18-24 crates/…/client.rs• L288-376
Cache ownership and concurrent access
Cache ownership protects an artifact while a pull, import, read, or publication uses it. Storage leases coordinate by installed entry name rather than content digest, so separate installed copies have separate lifetimes. Shared leases keep readers and their exact dependencies alive, while short publication protection and non-waiting deletion claims prevent replacement or pruning from observing an incomplete artifact set (crates/…/lease.rs• L14-120, crates/…/storage_lease.rs• L1-24, crates/…/storage_lease.rs• L116-127).
Descriptor leases also admit an existing immutable descriptor only after locking and checking that the locked file is still the named file. This protects snapshot reads from a concurrent replacement. The same coordination works for synchronous and asynchronous callers. Cache locks and leases retry without parking the async runtime, and a local release wakes a waiting operation before its backoff timer (crates/…/storage_lease.rs• L464-540, crates/…/storage_lease.rs• L561-605, crates/…/storage_lease.rs• L678-777, crates/…/async_gate.rs• L26-85, crates/…/async_gate.rs• L162-213, crates/…/lock.rs• L41-109).
References: crates/…/lease.rs• L14-120 crates/…/storage_lease.rs• L1-24 crates/…/storage_lease.rs• L116-127 crates/…/storage_lease.rs• L464-540 crates/…/storage_lease.rs• L561-605 crates/…/async_gate.rs• L26-85 crates/…/async_gate.rs• L162-213 crates/…/lock.rs• L41-109
End-to-end materialization flow
The flow below shows how external image data becomes either a layered virtual disk or a flat root filesystem.
flowchart TD
A[Registry reference] --> B[Resolve manifest and image config]
C[Docker or OCI archive] --> D[Read archive metadata and blobs]
B --> E[Validate layer descriptors and diff IDs]
D --> E
E --> F[Download or stage layer blobs]
F --> G[Ingest compressed tar layers]
G --> H[Build per-layer EROFS images]
H --> I{Requested output}
I -->|Layered| J[Merge metadata and provenance]
J --> K[Write fsmeta EROFS]
K --> L[Write VMDK descriptor]
I -->|Flat| M[Rebuild and merge layer trees]
M --> N[Format deterministic ext4 image]
I -->|All| J
I -->|All| N
The cache uses content identities at each stage. A valid layer EROFS image can be reused across manifest-specific outputs, while fsmeta, the VMDK, and a flat reference are tied to the image manifest and ordered layer set. Validity checks inspect EROFS structure instead of trusting file length alone. Temporary files, publication gates, and per-derivation locks keep incomplete work from becoming a visible cache result (crates/…/client.rs• L900-975, crates/…/store.rs• L494-597, crates/…/store.rs• L989-1014).
References: crates/…/client.rs• L900-975 crates/…/client.rs• L1225-1354 crates/…/store.rs• L494-597 crates/…/store.rs• L989-1014
Image ingestion
Registry ingestion
Registry ingestion resolves a reference into one platform-specific OCI image manifest, its config, and its ordered layer descriptors. It first checks complete local metadata according to the pull policy. If the image is not available locally, it contacts the registry and then persists the resolved metadata after materialization (crates/…/client.rs• L516-741, crates/…/client.rs• L1652-1715).
An OCI index is a multi-platform manifest. The registry path selects the host operating system and architecture, prefers an exact variant when one is available, and ignores attestation entries. A pull fails when no compatible manifest exists (crates/…/client.rs• L759-864).
Layer blobs are addressed by their compressed descriptor digest. Downloads are protected against concurrent writers, can resume from a partial file, and verify the compressed digest before publication. Layer materialization then verifies the uncompressed tar stream against the config diff_id (crates/…/download.rs• L67-165, crates/…/download.rs• L211-290, crates/…/client.rs• L1128-1139).
References: crates/…/client.rs• L516-741 crates/…/client.rs• L759-864 crates/…/client.rs• L900-1139 crates/…/download.rs• L67-165 crates/…/download.rs• L211-290
Archive ingestion
Archive ingestion brings image data into the same cache without a registry connection. A Docker archive is identified by manifest.json; an OCI image layout is identified by oci-layout and index.json. The loader reads the required config and layer blobs, checks their declared sizes and digests, and creates the same cached image metadata used by a registry pull (crates/…/docker.rs• L692-721, crates/…/docker.rs• L843-969, crates/…/docker.rs• L981-1224, crates/…/docker.rs• L1453-1528).
OCI archives may contain nested indexes. The loader follows only platform-compatible entries and keeps the source order of the resolved image manifests. Docker tags and OCI reference annotations provide names; a caller must supply a tag when the archive has no usable name (crates/…/docker.rs• L1316-1446, crates/…/docker.rs• L935-963, crates/…/docker.rs• L1194-1217).
Warm archive loads read only the small metadata entries when the image metadata, layer EROFS images, fsmeta, and VMDK are already valid. They still confirm that the archive contains the advertised layer members. If any required artifact is missing, the loader stages the blobs and sends them through the normal materialization path. The import publishes each loaded reference before releasing the operation pins, so a staged layer cannot be reclaimed during catalog installation (crates/…/docker.rs• L746-841, crates/…/docker.rs• L1030-1117, crates/…/docker.rs• L321-445).
The same cache can export Docker-compatible or OCI layout archives. Export reconstructs layer tar streams from cached EROFS data and preserves the ordered layer and config identity needed for a later import (crates/…/docker.rs• L448-483, crates/…/docker.rs• L485-689, crates/…/docker.rs• L1628-1679).
References: crates/…/docker.rs• L692-841 crates/…/docker.rs• L981-1224 crates/…/docker.rs• L1316-1528 crates/…/docker.rs• L321-445
Layer and manifest processing
Manifest and config records
The manifest identifies the compressed layer blobs. The image config supplies runtime defaults and the diff_id list, which is the digest of each layer's uncompressed tar stream. The two lists must have the same length and their positions must stay aligned (crates/…/config.rs• L11-43, crates/…/config.rs• L49-84, crates/…/client.rs• L611-623).
The registry and archive paths preserve both forms of identity. The descriptor digest protects the downloaded or staged compressed blob, while the config diff_id proves that decompression and tar processing produced the expected layer content. A mismatch stops materialization before the layer image is published (crates/…/client.rs• L1128-1139, crates/…/docker.rs• L1453-1503).
References: crates/…/config.rs• L11-43 crates/…/config.rs• L49-84 crates/…/client.rs• L611-623 crates/…/client.rs• L1128-1139 crates/…/docker.rs• L1453-1503
Layer tree ingestion
Layer ingestion converts an uncompressed or compressed OCI tar stream into a FileTree, which is the common logical filesystem view used by the EROFS and ext4 writers. It preserves file metadata and special entries while applying resource limits to paths, entries, file sizes, and total extracted data (crates/…/ingest.rs• L186-245, crates/…/ingest.rs• L300-403).
OCI whiteouts are deletion records rather than ordinary files. A named whiteout becomes a whiteout device entry, and an opaque whiteout marks its parent directory so lower-layer entries are hidden. Hardlinks retain shared inode identity, and large file data can use a spool file instead of staying in memory (crates/…/ingest.rs• L642-705, crates/…/ingest.rs• L710-743, crates/…/ingest.rs• L313-353).
References: crates/…/ingest.rs• L186-245 crates/…/ingest.rs• L300-403 crates/…/ingest.rs• L642-743
Layer order and merge state
Layers are processed from the bottom of the image to the top. The merge applies the upper layer's files and whiteouts over lower layers. It also keeps provenance, which records the layer that supplies each surviving file and allows the layered output to point to the correct data blocks (crates/…/client.rs• L1252-1278, crates/…/fsmeta.rs• L92-146).
The per-layer EROFS images retain file data and a data map. The merged tree used for fsmeta can then retain structure and metadata while regular-file content remains in the layer images. This split is the basis for sharing immutable data between image views (crates/…/writer.rs• L36-46, crates/…/fsmeta.rs• L344-421). When a layer is already cached, the system reconstructs the metadata tree and block map from the verified EROFS image instead of requiring the original tar blob (crates/…/client.rs• L1506-1650).
References: crates/…/client.rs• L1252-1278 crates/…/client.rs• L1506-1650 crates/…/writer.rs• L36-46 crates/…/fsmeta.rs• L92-146 crates/…/fsmeta.rs• L344-421
Filesystem artifact construction
Per-layer EROFS images
EROFS is the immutable filesystem format used for image layers. The writer stores the tree's directories, files, links, device nodes, metadata, and supported extended attributes in a block-aligned image. It returns a map from file paths to their data blocks so later stages can refer to those blocks (crates/…/writer.rs• L149-197).
The EROFS reader supports the image subset produced by this writer. The flat-rootfs path uses it to reconstruct trees from cached layer images, so it does not need the original tar files (crates/…/reader.rs• L1-8, crates/…/flat.rs• L91-112). Cache validation also reads the EROFS superblock and root directory before it accepts an artifact for reuse (crates/…/store.rs• L989-1008).
References: crates/…/writer.rs• L149-197 crates/…/reader.rs• L1-8 crates/…/flat.rs• L91-112 crates/…/store.rs• L989-1008
Layered fsmeta image
The layered rootfs uses a metadata-only EROFS image named fsmeta. It contains the merged directory tree and inode metadata. Regular files use chunk references that point through a device table to their owning layer's data blocks. Directories and link targets stay in the metadata image when they need local data (crates/…/fsmeta.rs• L92-146, crates/…/fsmeta.rs• L653-743).
The fsmeta image is specific to the resolved manifest because its merged tree and provenance depend on the complete ordered layer set. The layer EROFS images remain shared inputs, while fsmeta gives the runtime one view of the final root tree.
References: crates/…/fsmeta.rs• L92-146 crates/…/fsmeta.rs• L653-743 crates/…/client.rs• L1225-1287
Flat ext4 rootfs
The flat rootfs is one raw ext4 image that contains the fully merged tree and its file data. It is useful when the consumer needs a reusable writable-root image instead of a layer-aware read-only composition (crates/…/flat.rs• L27-35).
The flat path rebuilds the complete tree from cached EROFS layers, then formats and validates ext4 before publication. Its derivation identity includes the manifest, ordered layer identities, target platform, and materializer ABI. The cache stores immutable raw bytes by content digest and a separate manifest-keyed reference, so a changed input or materializer profile becomes a cache miss (crates/…/flat.rs• L42-88, crates/…/flat.rs• L115-165, crates/…/store.rs• L468-597).
References: crates/…/flat.rs• L27-35 crates/…/flat.rs• L42-88 crates/…/flat.rs• L115-165 crates/…/store.rs• L468-597
Offline ext4 storage
Offline ext4 operations use one logical storage interface for raw files and explicitly resolved qcow2 files. The caller must exclude other writers while the filesystem changes its length or contents. Growth keeps the file sparse where the host supports it, and completion includes a storage sync (crates/…/storage.rs• L1-15, crates/…/storage.rs• L21-45).
This boundary lets ext4 growth work with a resolved disk view without allowing an implicit backing path to change the artifact being updated. It is separate from rootfs creation: rootfs materialization creates and validates a complete cache candidate before publication.
References: crates/…/storage.rs• L1-15 crates/…/storage.rs• L21-45 crates/…/rootfs.rs• L84-120
VMDK stitched rootfs
The VMDK is a small descriptor that concatenates the fsmeta image and the ordered per-layer EROFS images into one virtual disk. It does not copy their data. The descriptor uses flat extents and splits any extent larger than the VMDK extent limit (crates/…/vmdk.rs• L15-20, crates/…/vmdk.rs• L47-85).
The runtime attaches this VMDK as a read-only root disk and attaches the writable upper separately. This keeps immutable image content separate from sandbox changes (crates/…/vm.rs• L1462-1495, crates/…/vm.rs• L1497-1525). If the descriptor is lost while fsmeta and all layers remain valid, the system can regenerate only the VMDK (crates/…/client.rs• L961-969, crates/…/store.rs• L331-465).
References: crates/…/vmdk.rs• L15-20 crates/…/vmdk.rs• L47-85 crates/…/client.rs• L961-969 crates/…/store.rs• L331-465 crates/…/vm.rs• L1462-1525
Snapshot artifacts
Checkpoint object closure
A checkpoint closure is a self-contained set of canonical manifests and immutable content objects that can describe a resumable guest state. The root checkpoint manifest binds execution state, memory, disk generations, device state, resource treatment, and the VM geometry to one pause generation. Its digest identifies the canonical manifest bytes (crates/…/mod.rs• L1-4, crates/…/mod.rs• L24-40).
Restore admission opens the root and validates every transitively referenced manifest, object slice, disk layer, owned backing, and pause-generation link. Portable inspection can skip host-architecture matching, while a verification plan can defer large payload hashing for grouped checks; neither weaker path is restore admission (crates/…/resolver.rs• L31-44, crates/…/resolver.rs• L121-169, crates/…/resolver.rs• L171-285, crates/…/resolver.rs• L367-405).
The local object store addresses content by SHA-256 and verifies existing bytes before reuse. Capture batches make object data durable, retain validated object receipts for later generations, link the objects into a closure, and finish directory syncs before a caller publishes the closure root. This separates immutable guest content from mutable operation state and runtime ownership (crates/…/store.rs• L30-76, crates/…/store.rs• L108-143, crates/…/store.rs• L220-243, crates/…/store.rs• L276-383).
Memory can refer to complete or reused object ranges. Disk files can also carry sparse-aware BLAKE3 integrity over their logical size, so holes and allocated data have one stable identity (crates/…/store.rs• L633-701).
References: crates/…/mod.rs• L1-4 crates/…/mod.rs• L24-40 crates/…/resolver.rs• L31-44 crates/…/resolver.rs• L121-169 crates/…/resolver.rs• L171-285 crates/…/resolver.rs• L367-405 crates/…/store.rs• L30-76 crates/…/store.rs• L108-143 crates/…/store.rs• L220-243 crates/…/store.rs• L276-383 crates/…/store.rs• L633-701
Checkpoint disk materialization
Checkpoint disk generations can retain a raw base and qcow2 overlays as an explicit immutable chain. Compaction reads only the supplied chain and can produce a standalone sparse qcow2 layer that preserves guest-visible bytes without following ambient backing paths (crates/…/mod.rs• L18-31, crates/…/compact.rs• L21-37, crates/…/compact.rs• L43-106).
The checkpoint manifest records disk generations as content references rather than treating a host path as the identity of the disk. A compacted result is therefore a new immutable disk object that can be checked and moved with the rest of the closure (crates/…/manifest.rs• L100, crates/…/manifest.rs• L156-187, crates/…/compact.rs• L98-167).
References: crates/…/mod.rs• L18-31 crates/…/manifest.rs• L100 crates/…/compact.rs• L21-37 crates/…/compact.rs• L43-106 crates/…/compact.rs• L98-167
Snapshot descriptor
A snapshot artifact is a self-describing directory. Its snapshot.json descriptor is the source of truth and its canonical bytes define the snapshot's SHA-256 identity. The descriptor pins the base image manifest digest and records either file-backed disk state or a checkpoint-backed state (crates/…/mod.rs• L1-6, crates/…/manifest.rs• L1-3, crates/…/manifest.rs• L150-199).
Current file snapshots describe a raw or qcow2 payload and its filesystem type. A disk-only file state is supported today; a resumable scope represents disk, memory, and device state for the checkpoint path. The descriptor also records the parent snapshot identity, labels, and optional payload integrity (crates/…/manifest.rs• L63-72, crates/…/manifest.rs• L138-199).
Owned snapshot resources keep a one-to-one binding between runtime resources and captured backing. Directory payloads are confined to the artifact and checked for size and digest. Owned disks must retain a valid generation chain, so a snapshot cannot silently replace required state with an external mount (crates/…/owned.rs• L19-65, crates/…/owned.rs• L68-121, crates/…/mod.rs• L29-33).
References: crates/…/mod.rs• L1-6 crates/…/mod.rs• L19-33 crates/…/manifest.rs• L1-3 crates/…/manifest.rs• L138-199 crates/…/owned.rs• L19-65 crates/…/owned.rs• L68-121
Snapshot index and artifact truth
The local snapshot index is a query cache. It projects descriptor fields such as the parent edge, image digest, state kind, availability, and migration state. Opening or reindexing an artifact reads from disk rather than treating an index row as the payload (crates/…/snapshot.rs• L1-5, crates/…/snapshot.rs• L13-57, sdk/…/mod.rs• L155-190).
This separation lets an artifact move between hosts or recover after an index loss. The index must still track parent-child links and current availability so list, remove, and migration operations can make safe decisions.
References: crates/…/snapshot.rs• L1-5 crates/…/snapshot.rs• L13-57 sdk/…/mod.rs• L155-190
Snapshot archive save and load
Snapshot save creates a tar archive by default compressed with zstd. It includes the head snapshot and can include its parent chain. With with_image, it also includes the cached image metadata, fsmeta, VMDK, and each layer EROFS image needed for offline boot (sdk/…/archive.rs• L190-267).
The archive contains descriptors under snapshots/, file payloads under files/, optional image objects under cache/, and an archive.json inventory. The inventory records the head, included snapshots, member sizes, content integrity, and completeness. It is also the allowlist used by the writer, so unknown files in an artifact directory are not exported (sdk/…/archive.rs• L479-535, sdk/…/archive.rs• L554-646).
Load streams the archive into private snapshot and cache staging areas. It verifies the imported descriptors and inventory bindings, installs cache objects, promotes the snapshot directories, and rebuilds the local index. Plain tar is accepted as well as zstd tar (sdk/…/archive.rs• L338-430).
References: sdk/…/archive.rs• L190-267 sdk/…/archive.rs• L338-430 sdk/…/archive.rs• L479-646
Snapshot migration and archival paths
Adjacent-release migration converts older descriptor shapes into the current descriptor shape without making a legacy format the normal reader. The v0.6.6 manifest.json path checks the descriptor and payload binding, preserves the source identity, maps the parent edge, and writes the current file-state descriptor. The released v0.6.7-v0.6.16 snapshot.json family has a separate translation path that can normalize either file or checkpoint state (crates/…/migration.rs• L1-5, crates/…/migration.rs• L196-266, crates/…/migration.rs• L362-453).
Migration keeps a journal so discovery, planning, publication, and completion can be retried without losing the source identity or the payload binding. Reverse paths exist only for representable disk-only raw ext4 snapshots. Current-only extensions, checkpoint state, captured root layouts, unsupported disk formats, or unsupported integrity shapes block downgrade instead of silently losing data (crates/…/m20260723_000001_snapshot_artifact_transition.rs• L86-117, crates/…/migration.rs• L280-359, crates/…/migration.rs• L456-531).
Snapshot archives can carry legacy artifacts through the same normalization gate before verification and promotion. This makes archive import and startup reconciliation use one descriptor conversion rule (sdk/…/archive.rs• L391-425, sdk/…/migration.rs• L132-178).
References: crates/…/migration.rs• L1-5 crates/…/migration.rs• L196-266 crates/…/migration.rs• L362-453 crates/…/migration.rs• L280-359 crates/…/migration.rs• L456-531 sdk/…/migration.rs• L95-178
Change checklist
When these files or sections are changed, remember to consider these:
- When manifest, config, or layer order changes, check the alignment between descriptor digests, config
diff_ids, layer provenance,fsmetachunk references, and VMDK extent order. - When archive format or archive warm-load rules change, check Docker and OCI detection, platform selection, name fallback, blob validation, staged-layer ownership, and the registry materialization path.
- When cache artifact names or validity rules change, check manifest-keyed metadata, diff-ID layer objects, flat references and blobs, VMDK regeneration, and snapshot archive image bundling.
- When operation leases, async lock coordination, or storage lease keys change, check readers, publishers, deletions, mutable reference replacement, descriptor admission, and cancellation of blocking workers. Lifetime pins and publication gates must remain separate (crates/…/storage_lease.rs• L1-24, crates/…/storage_lease.rs• L464-540, crates/…/storage_lease.rs• L678-777).
- When the ext4 materializer changes, update the materializer ABI and confirm that flat derivation checks reject old images rather than reusing them.
- When EROFS layout or reader support changes, check both per-layer images and the
fsmetadata-map contract. Flat reconstruction depends on the reader being able to recover the writer's image subset. - When ext4 offline growth changes, check raw and explicitly resolved qcow2 callers, sparse growth behavior, exclusive-writer assumptions, and the sync boundary before publication.
- When checkpoint manifest or object-store rules change, check canonical digest identity, pause-generation bindings, object closure links, retained-object admission, payload verification planning, and directory durability before root publication (crates/…/resolver.rs• L367-405, crates/…/store.rs• L220-243, crates/…/store.rs• L366-387).
- When checkpoint owned-volume or snapshot resource rules change, check the one-to-one binding between resource descriptors and captured directory or disk backing (crates/…/owned.rs• L19-65).
- When snapshot descriptor fields or filenames change, update canonical identity rules, archive inventory bindings, index projections, and all supported migration directions.
- When snapshot archive member paths or completeness rules change, update the archive allowlist, transport integrity records, staged promotion, and offline image-cache installation together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| No manifest in the requested host platform | The pull or OCI archive load stops before layer processing. | Platform matching resolves OS, architecture, and variant before extracting layers (crates/…/client.rs• L797-843, crates/…/docker.rs• L1347-1450). |
Config diff_id count differs from manifest layer count | Layer positions cannot be trusted, so materialization fails. | Count equality is checked before the layer pipeline starts (crates/…/client.rs• L611-623, crates/…/docker.rs• L881-888, crates/…/docker.rs• L1160-1167). |
| Compressed blob or uncompressed tar digest differs from its declared digest | The layer is rejected and the bad cache object is not published. | Archive and download hashing check descriptor content; tar ingestion checks the config diff_id (crates/…/docker.rs• L1453-1503, crates/…/client.rs• L1128-1139, crates/…/download.rs• L257-270). |
| Tar path traversal, invalid hardlink, or unsupported resource size | The layer cannot become a file tree. | Path, link, entry, and size checks run during tar ingestion (crates/…/ingest.rs• L69-94, crates/…/ingest.rs• L205-249). |
| An aligned file is not a valid EROFS image | A corrupt layer or fsmeta artifact is not reused and must be rebuilt. | Cache validation parses the EROFS superblock and root directory (crates/…/store.rs• L989-1008). |
Missing layer EROFS image or manifest-specific fsmeta/VMDK | The requested rootfs view is rebuilt or the operation fails if its source is unavailable. | Cache validity checks and per-derivation locks guard reuse and rebuild (crates/…/client.rs• L939-975, crates/…/client.rs• L1240-1250). |
| VMDK extent is not 512-byte aligned | The stitched disk descriptor is not written. | The VMDK writer rejects unaligned extents before writing the descriptor (crates/…/vmdk.rs• L24-41). |
| Ext4 growth runs while another writer changes the logical disk | The filesystem operation can observe inconsistent bytes or corrupt the artifact. | Ext4 storage requires callers to exclude other writers and provides one sync boundary (crates/…/storage.rs• L10-15). |
| A reader loses its lease before catalog publication | Reclamation or replacement can remove a dependency while the published record still points to it. | Operation scopes retain shared leases through publication, and separate publication gates protect metadata replacement (crates/…/lease.rs• L57-120, crates/…/store.rs• L644-804, crates/…/storage_lease.rs• L542-576). |
| A checkpoint inspection or verification plan is used as restore admission | Missing or changed payloads can reach restore without the required full closure checks. | Restore uses CheckpointClosure::open; portable inspection and deferred verification remain separate paths (crates/…/resolver.rs• L121-169, crates/…/resolver.rs• L367-405). |
| Checkpoint object bytes are changed, replaced, or not durably linked before manifest publication | Restore can resolve the wrong content or find an incomplete closure. | Content-addressed verification, admitted-object checks, and batch directory syncs fail closed (crates/…/store.rs• L194-214, crates/…/store.rs• L239-273, crates/…/store.rs• L366-387, crates/…/store.rs• L457-473). |
| Checkpoint memory extents overlap or use a different pause generation | The checkpoint cannot describe one coherent guest state. | Manifest validation requires sorted non-overlapping ranges and same-epoch owned disks (crates/…/manifest.rs• L239-280). |
| Owned runtime resource has no matching captured directory or disk backing | Restore cannot safely recreate the resource and the closure is rejected. | Resource bindings and captured volumes must match one-to-one; directory payloads also require size and digest checks (crates/…/owned.rs• L19-65, crates/…/owned.rs• L91-121). |
| Snapshot archive lacks a required descriptor, payload, or bundled image object | Import stops in staging and does not promote a partial artifact. | Inventory bindings and staged installation are verified before promotion (sdk/…/archive.rs• L391-425). |
| Legacy snapshot payload size or downgrade shape is not representable | Migration is blocked and the source remains available for recovery. | Forward binding checks size; reverse translation limits state, format, filesystem, root layout, and extensions (crates/…/migration.rs• L596-607, crates/…/migration.rs• L291-317, crates/…/migration.rs• L463-496). |
Key files
| File | Why to read it |
|---|---|
| crates/…/client.rs | Main registry pull flow, platform resolution, layer pipeline, cached EROFS reconstruction, and layered artifact assembly. |
| crates/…/docker.rs | Docker and OCI archive detection, platform resolution, validation, cache staging, warm reuse, and export. |
| crates/…/mod.rs | Public archive load and save surface. |
| crates/…/config.rs | The relationship between image runtime config and ordered layer diff_ids. |
| crates/…/ingest.rs | OCI tar-to-tree behavior, including whiteouts, hardlinks, and input limits. |
| crates/…/writer.rs | Per-layer immutable filesystem output and file block maps. |
| crates/…/fsmeta.rs | Merged metadata image and references from files to layer data. |
| crates/…/flat.rs | Rebuilding and publishing a flat rootfs from cached layer images. |
| crates/…/rootfs.rs | Deterministic ext4 rootfs sizing, formatting, validation, and identity data. |
| crates/…/storage.rs | Shared offline disk boundary for raw and explicitly resolved qcow2 ext4 operations. |
| crates/…/vmdk.rs | The virtual disk descriptor that joins read-only filesystem extents. |
| crates/…/store.rs | Cache identity, artifact paths, EROFS validity checks, flat blob publication, and metadata publication. |
| crates/…/lease.rs | Operation-scoped dependency protection through image and catalog publication. |
| crates/…/lock.rs | Cross-process artifact locking for downloads and materialization. |
| crates/…/async_gate.rs | Local coordination that keeps async lock retries non-blocking and promptly wakeable. |
| crates/…/storage_lease.rs | Shared, exclusive, and descriptor-level coordination for installed storage entries. |
| crates/…/mod.rs | Public checkpoint artifact surface for manifests, object storage, qcow2 handling, and compaction. |
| crates/…/resolver.rs | Closure admission and separate portable verification planning for checkpoint restore. |
| crates/…/manifest.rs | Canonical checkpoint and memory closure records with same-epoch validation. |
| crates/…/store.rs | Content-addressed guest-state storage, retained object admission, closure linking, durability, and sparse integrity. |
| crates/…/compact.rs | Explicit raw/qcow2 chain validation and standalone disk materialization. |
| crates/…/manifest.rs | Snapshot descriptor identity, state variants, and payload binding rules. |
| crates/…/owned.rs | Validation of captured owned directory and disk backing against runtime resources. |
| sdk/…/archive.rs | Snapshot bundle contents, sparse payload handling, verification, and promotion. |
| crates/…/migration.rs | Pure descriptor translation between legacy, released flat, and current snapshot shapes. |
| sdk/…/migration.rs | Host-side discovery, graph planning, journaling, and publication of migrated artifacts. |