Documentation ¶
Index ¶
- Constants
- func ConvertHookFunc(opt PackOption) converter.ConvertHookFunc
- func LayerConvertFunc(opt PackOption) converter.ConvertFunc
- func Merge(ctx context.Context, layers []Layer, dest io.Writer, opt MergeOption) error
- func Pack(ctx context.Context, dest io.Writer, opt PackOption) (io.WriteCloser, error)
- func Unpack(ctx context.Context, ia content.ReaderAt, dest io.Writer, opt UnpackOption) error
- type Layer
- type MergeOption
- type PackOption
- type UnpackOption
Constants ¶
const ( ManifestOSFeatureNydus = "nydus.remoteimage.v1" MediaTypeNydusBlob = "application/vnd.oci.image.layer.nydus.blob.v1" BootstrapFileNameInLayer = "image/image.boot" ManifestNydusCache = "containerd.io/snapshot/nydus-cache" LayerAnnotationFSVersion = "containerd.io/snapshot/nydus-fs-version" 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 ConvertHookFunc ¶ added in v0.3.0
func ConvertHookFunc(opt PackOption) converter.ConvertHookFunc
ConvertHookFunc returns a function which will be used as a callback called for each blob after conversion is done. The function only hooks the manifest conversion. The function merges all the nydus blob layers into a nydus bootstrap layer and modify the config.
func LayerConvertFunc ¶ added in v0.3.0
func LayerConvertFunc(opt PackOption) converter.ConvertFunc
LayerConvertFunc returns a function which converts an OCI image layer to a nydus blob layer, and set the media type to "application/vnd.oci.image.layer.nydus.blob.v1".
func Pack ¶ added in v0.3.0
func Pack(ctx context.Context, dest io.Writer, opt PackOption) (io.WriteCloser, error)
Pack 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.
Types ¶
type MergeOption ¶
type MergeOption struct { // WorkDir is used as the work directory during layer merge. WorkDir string // BuilderPath holds the path of `nydus-image` binary tool. BuilderPath string // 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 }
type PackOption ¶ added in v0.3.0
type PackOption struct { // WorkDir is used as the work directory during layer pack. WorkDir string // BuilderPath holds the path of `nydus-image` binary tool. BuilderPath string // FsVersion specifies nydus RAFS format version, possible // values: `5`, `6` (EROFS-compatible), default is `5`. FsVersion string // ChunkDictPath holds the bootstrap path of chunk dict image. ChunkDictPath string // PrefetchPatterns holds file path pattern list want to prefetch. PrefetchPatterns string // Compressor specifies nydus blob compression algorithm. Compressor string // Backend uploads blobs generated by nydus-image builder to a backend storage. Backend backend.Backend }