Documentation ¶
Index ¶
- Constants
- Variables
- func Config(ctx context.Context, provider content.Provider, image ocispec.Descriptor) (ocispec.Descriptor, error)
- func Dispatch(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) error
- func RootFS(ctx context.Context, provider content.Provider, configDesc ocispec.Descriptor) ([]digest.Digest, error)
- func Walk(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) error
- type Handler
- type HandlerFunc
- type Image
- type Store
Constants ¶
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 ¶
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)
Config resolves the image configuration descriptor using a content provided to resolve child resources on the image.
The caller can then use the descriptor to resolve and process the configuration of the image.
func Dispatch ¶
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.
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.
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 }