Documentation ¶
Overview ¶
Package converter provides image converter
Index ¶
- func ClearGCLabels(labels map[string]string, dgst digest.Digest)
- func Convert(ctx context.Context, client Client, dstRef, srcRef string, opts ...Opt) (*images.Image, error)
- func ConvertDockerMediaTypeToOCI(mt string) string
- type Client
- type ConvertFunc
- type ConvertHookFunc
- type ConvertHooks
- type DualConfig
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearGCLabels ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.