images

package
v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: Apache-2.0, CC-BY-SA-4.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaTypeDockerSchema2Layer        = "application/vnd.docker.image.rootfs.diff.tar"
	MediaTypeDockerSchema2LayerGzip    = "application/vnd.docker.image.rootfs.diff.tar.gzip"
	MediaTypeDockerSchema2Config       = "application/vnd.docker.container.image.v1+json"
	MediaTypeDockerSchema2Manifest     = "application/vnd.docker.distribution.manifest.v2+json"
	MediaTypeDockerSchema2ManifestList = "application/vnd.docker.distribution.manifest.list.v2+json"
	// Checkpoint/Restore Media Types
	MediaTypeContainerd1Checkpoint        = "application/vnd.containerd.container.criu.checkpoint.criu.tar"
	MediaTypeContainerd1CheckpointPreDump = "application/vnd.containerd.container.criu.checkpoint.predump.tar"
	MediaTypeContainerd1Resource          = "application/vnd.containerd.container.resource.tar"
	MediaTypeContainerd1RW                = "application/vnd.containerd.container.rw.tar"
	MediaTypeContainerd1CheckpointConfig  = "application/vnd.containerd.container.checkpoint.config.v1+proto"
	// Legacy Docker schema1 manifest
	MediaTypeDockerSchema1Manifest = "application/vnd.docker.distribution.manifest.v1+prettyjws"
)

mediatype definitions for image components handled in containerd.

oci components are generally referenced directly, although we may centralize here for clarity.

Variables

View Source
var (
	// SkipDesc is used to skip processing of a descriptor and
	// its descendants.
	SkipDesc = fmt.Errorf("skip descriptor")

	// StopHandler is used to signify that the descriptor
	// has been handled and should not be handled further.
	// This applies only to a single descriptor in a handler
	// chain and does not apply to descendant descriptors.
	StopHandler = fmt.Errorf("stop handler")
)

Functions

func Config

func Config(ctx context.Context, provider content.Provider, image ocispec.Descriptor) (ocispec.Descriptor, error)

func Dispatch

func Dispatch(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) error

Dispatch runs the provided handler for content specified by the descriptors. If the handler decode subresources, they will be visited, as well.

Handlers for siblings are run in parallel on the provided descriptors. A handler may return `SkipDesc` to signal to the dispatcher to not traverse any children.

Typically, this function will be used with `FetchHandler`, often composed with other handlers.

If any handler returns an error, the dispatch session will be canceled.

func RootFS

func RootFS(ctx context.Context, provider content.Provider, configDesc ocispec.Descriptor) ([]digest.Digest, error)

RootFS returns the unpacked diffids that make up and images rootfs.

These are used to verify that a set of layers unpacked to the expected values.

func Walk

func Walk(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) error

Walk the resources of an image and call the handler for each. If the handler decodes the sub-resources for each image,

This differs from dispatch in that each sibling resource is considered synchronously.

Types

type Handler

type Handler interface {
	Handle(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error)
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error)

func ChildrenHandler

func ChildrenHandler(provider content.Provider) HandlerFunc

ChildrenHandler decodes well-known manifests types and returns their children.

This is useful for supporting recursive fetch and other use cases where you want to do a full walk of resources.

One can also replace this with another implementation to allow descending of arbitrary types.

func Handlers

func Handlers(handlers ...Handler) HandlerFunc

Handlers returns a handler that will run the handlers in sequence.

A handler may return `StopHandler` to stop calling additional handlers

func (HandlerFunc) Handle

func (fn HandlerFunc) Handle(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error)

type Image

type Image struct {
	Name                 string
	Labels               map[string]string
	Target               ocispec.Descriptor
	CreatedAt, UpdatedAt time.Time
}

Image provides the model for how containerd views container images.

func (*Image) Config

func (image *Image) Config(ctx context.Context, provider content.Provider) (ocispec.Descriptor, error)

Config resolves the image configuration descriptor.

The caller can then use the descriptor to resolve and process the configuration of the image.

func (*Image) RootFS

func (image *Image) RootFS(ctx context.Context, provider content.Provider) ([]digest.Digest, error)

RootFS returns the unpacked diffids that make up and images rootfs.

These are used to verify that a set of layers unpacked to the expected values.

func (*Image) Size

func (image *Image) Size(ctx context.Context, provider content.Provider) (int64, error)

Size returns the total size of an image's packed resources.

type Store

type Store interface {
	Get(ctx context.Context, name string) (Image, error)
	List(ctx context.Context, filters ...string) ([]Image, error)
	Create(ctx context.Context, image Image) (Image, error)

	// Update will replace the data in the store with the provided image. If
	// one or more fieldpaths are provided, only those fields will be updated.
	Update(ctx context.Context, image Image, fieldpaths ...string) (Image, error)

	Delete(ctx context.Context, name string) error
}

Jump to

Keyboard shortcuts

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