converter

package
v1.6.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 14 Imported by: 19

Documentation

Overview

Package converter provides image converter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearGCLabels

func ClearGCLabels(labels map[string]string, dgst digest.Digest)

ClearGCLabels clears GC labels for the given digest.

func Convert

func Convert(ctx context.Context, client Client, dstRef, srcRef string, opts ...Opt) (*images.Image, error)

Convert converts an image.

func ConvertDockerMediaTypeToOCI

func ConvertDockerMediaTypeToOCI(mt string) string

ConvertDockerMediaTypeToOCI converts a media type string

Types

type Client

type Client interface {
	WithLease(ctx context.Context, opts ...leases.Opt) (context.Context, func(context.Context) error, error)
	ContentStore() content.Store
	ImageService() images.Store
}

Client is implemented by *containerd.Client .

type ConvertFunc

type ConvertFunc func(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error)

ConvertFunc returns a converted content descriptor. When the content was not converted, ConvertFunc returns nil.

func DefaultIndexConvertFunc

func DefaultIndexConvertFunc(layerConvertFunc ConvertFunc, docker2oci bool, platformMC platforms.MatchComparer) ConvertFunc

DefaultIndexConvertFunc is the default convert func used by Convert.

func IndexConvertFuncWithHook added in v1.6.0

func IndexConvertFuncWithHook(layerConvertFunc ConvertFunc, docker2oci bool, platformMC platforms.MatchComparer, hooks ConvertHooks) ConvertFunc

IndexConvertFuncWithHook is the convert func used by Convert with hook functions support.

type ConvertHookFunc added in v1.6.0

type ConvertHookFunc func(ctx context.Context, cs content.Store, orgDesc ocispec.Descriptor, newDesc *ocispec.Descriptor) (*ocispec.Descriptor, error)

ConvertHookFunc is a callback function called during conversion of a blob. orgDesc is the target descriptor to convert. newDesc is passed if conversion happens.

type ConvertHooks added in v1.6.0

type ConvertHooks struct {
	// PostConvertHook is a callback function called for each blob after conversion is done.
	PostConvertHook ConvertHookFunc
}

ConvertHooks is a configuration for hook callbacks called during blob conversion.

type DualConfig

type DualConfig map[string]*json.RawMessage

DualConfig covers Docker config (v1.0, v1.1, v1.2) and OCI config. Unmarshalled as map[string]*json.RawMessage to retain unknown fields on remarshalling.

type Opt

type Opt func(*convertOpts) error

Opt is an option for Convert()

func WithDockerToOCI

func WithDockerToOCI(v bool) Opt

WithDockerToOCI converts Docker media types into OCI ones.

func WithIndexConvertFunc

func WithIndexConvertFunc(fn ConvertFunc) Opt

WithIndexConvertFunc specifies the function that converts manifests and index (manifest lists). Defaults to DefaultIndexConvertFunc.

func WithLayerConvertFunc

func WithLayerConvertFunc(fn ConvertFunc) Opt

WithLayerConvertFunc specifies the function that converts layers.

func WithPlatform

func WithPlatform(p platforms.MatchComparer) Opt

WithPlatform specifies the platform. Defaults to all platforms.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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