converter

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

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.

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 DualIndex

type DualIndex struct {
	ocispec.Index
	ObjectWithMediaType
}

DualIndex covers Docker manifest list and OCI index

type DualManifest

type DualManifest struct {
	ocispec.Manifest
	ObjectWithMediaType
}

DualManifest covers Docker manifest and OCI manifest

type ObjectWithMediaType

type ObjectWithMediaType struct {
	// MediaType appears on Docker manifests and manifest lists.
	// MediaType does not appear on OCI manifests and index
	MediaType string `json:"mediaType,omitempty"`
}

ObjectWithMediaType represents an object with a MediaType field

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