converter

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Index

Constants

View Source
const (
	ManifestOSFeatureNydus   = "nydus.remoteimage.v1"
	MediaTypeNydusBlob       = "application/vnd.oci.image.layer.nydus.blob.v1"
	BootstrapFileNameInLayer = "image/image.boot"

	ManifestNydusCache = "containerd.io/snapshot/nydus-cache"

	LayerAnnotationNydusBlob          = "containerd.io/snapshot/nydus-blob"
	LayerAnnotationNydusBlobDigest    = "containerd.io/snapshot/nydus-blob-digest"
	LayerAnnotationNydusBlobSize      = "containerd.io/snapshot/nydus-blob-size"
	LayerAnnotationNydusBlobIDs       = "containerd.io/snapshot/nydus-blob-ids"
	LayerAnnotationNydusBootstrap     = "containerd.io/snapshot/nydus-bootstrap"
	LayerAnnotationNydusSourceChainID = "containerd.io/snapshot/nydus-source-chainid"

	LayerAnnotationNydusReferenceBlobIDs = "containerd.io/snapshot/nydus-reference-blob-ids"

	LayerAnnotationUncompressed = "containerd.io/uncompressed"
)

Variables

This section is empty.

Functions

func Convert

func Convert(ctx context.Context, dest io.Writer, opt ConvertOption) (io.WriteCloser, error)

Convert converts a OCI formatted tar stream to a nydus formatted tar stream

The nydus blob tar stream contains blob and bootstrap files with the following file tree structure:

/image ├── image.blob ├── image.boot

So for the chunk of files in the nydus boostreap, a blob compressed offset of 1024 (size_of(tar_header) * 2) is required.

Important: the caller must check `io.WriteCloser.Close() == nil` to ensure the conversion workflow is finish.

func Merge

func Merge(ctx context.Context, layers []Layer, dest io.Writer, opt MergeOption) error

Merge multiple nydus boostraps (from every layer of image) to a final boostrap.

Types

type ConvertOption

type ConvertOption struct {
	// RafsVersion specifies nydus format version, possible values:
	// `5`, `6` (EROFS-compatible), default is `5`.
	RafsVersion string
	// ChunkDictPath holds the bootstrap path of chunk dict image.
	ChunkDictPath string
	// PrefetchPatterns holds file path pattern list want to prefetch.
	PrefetchPatterns string
}

type Layer

type Layer struct {
	// Digest represents the hash of whole tar blob.
	Digest digest.Digest
	// ReaderAt holds the reader of whole tar blob.
	ReaderAt io.ReaderAt
}

type MergeOption

type MergeOption struct {
	// ChunkDictPath holds the bootstrap path of chunk dict image.
	ChunkDictPath string
	// PrefetchPatterns holds file path pattern list want to prefetch.
	PrefetchPatterns string
	// WithTar puts bootstrap into a tar stream (no gzip).
	WithTar bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL