Skip to main content

Crate ocirender

Crate ocirender 

Source
Expand description

OCI image conversion library.

Converts OCI container images into squashfs filesystem images, plain tar archives, or extracted directories by merging the image’s layer tarballs directly, without extracting them to intermediate disk storage.

§Concepts

An OCI image is a stack of compressed tar archives (layers). Converting an image means applying them oldest-first, with newer layers overwriting older ones and whiteout files representing deletions. This library implements that merge as a streaming algorithm: entries flow from the compressed layer blobs through the overlay logic directly into the chosen output sink.

The output format and destination are described by ImageSpec, which is also used as the input source for verify::verify. The same type is used in both directions to avoid a parallel set of read vs. write descriptors.

§Conversion

For simple one-shot conversions, use convert or one of its named convenience wrappers (convert_mksquashfs, convert_tar, convert_dir).

When layers are being downloaded concurrently, use StreamingPacker or one of the _streaming convenience wrappers. These accept layers in any arrival order; the merge engine resequences them internally and processes each layer as soon as its turn arrives, keeping the output sink busy while remaining layers are still in flight.

§Verification

See verify::verify for comparing a generated image against a reference directory.

Modules§

canonical
PAX-aware tar header type used throughout the merge pipeline.
dir
Directory output sink for the OCI layer merge pipeline.
image
OCI image layout parsing: reads index.json or manifest.json and resolves layer descriptors to blob file paths on disk.
layers
Layer blob decompression.
overlay
Core OCI layer merge algorithm.
squashfs
squashfs output sink for the OCI layer merge pipeline.
tar
Tar file output sink for the OCI layer merge pipeline.
tracker
State tracking data structures for the OCI layer merge algorithm.
verify
Verification: diff a generated image against a reference directory.

Structs§

LayerMeta
Manifest-derived metadata for a single layer, captured before downloading begins.
StreamingPacker
A streaming image packer that accepts layers in any order as downloads complete.

Enums§

ImageSpec
Format, location, and format-specific configuration of an image.
PackerProgress
Progress events emitted by the merge engine as layers are processed.

Functions§

convert
Convert an OCI image directory into the format and location described by spec.
convert_dir
Extract an OCI image directory directly into output_dir.
convert_dir_streaming
Streaming variant of convert_dir.
convert_mksquashfs
Convert an OCI image directory into a squashfs file.
convert_mksquashfs_streaming
Streaming variant of convert_mksquashfs.
convert_tar
Convert an OCI image directory into a plain tar file.
convert_tar_streaming
Streaming variant of convert_tar.