store

package
v1.12.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package store implements OCI container storage.

Index

Constants

View Source
const (
	DirDigests    = "d"
	DirImages     = "i"
	DirOverlays   = "o"
	DirContainers = "c"
)

Store directories. Shorter is better, to avoid passing too much data to the mount syscall when creating an overlay mount with many layers as lower directories.

View Source
const (
	DirRootFS  = "rootfs"
	FileConfig = "config.json"
	FileSpec   = "config.json"
)

Bundle paths.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle interface {
	// Path of the OCI bundle.
	Path() string

	// Cleanup the OCI bundle after the container has finished running.
	Cleanup() error
}

A Bundle for use by an OCI runtime.

type Bundler

type Bundler interface {
	// Bundle returns an OCI bundle ready for use by an OCI runtime.
	Bundle(ctx context.Context, i ociv1.Image, id string, o ...spec.Option) (Bundle, error)
}

A Bundler prepares OCI runtime bundles for use by an OCI runtime.

type Digest

type Digest struct {
	// contains filtered or unexported fields
}

A Digest store is used to map OCI references to digests. Each mapping is a file. The filename is the SHA256 hash of the reference, and the content is the digest in algo:hex format.

func NewDigest

func NewDigest(root string) (*Digest, error)

NewDigest returns a store used to map OCI references to digests.

func (*Digest) Hash

func (d *Digest) Hash(r name.Reference) (ociv1.Hash, error)

Hash returns the stored hash for the supplied reference.

func (*Digest) WriteHash

func (d *Digest) WriteHash(r name.Reference, h ociv1.Hash) error

WriteHash maps the supplied reference to the supplied hash.

type Image

type Image struct {
	// contains filtered or unexported fields
}

An Image store is used to store OCI images and their layers. It uses a similar disk layout to the blobs directory of an OCI image layout, but may contain blobs for more than one image. Layers are stored as uncompressed tarballs in order to speed up extraction by the uncompressed Bundler, which extracts a fresh root filesystem each time a container is run. https://github.com/opencontainers/image-spec/blob/v1.0/image-layout.md

func NewImage

func NewImage(root string) *Image

NewImage returns a store used to store OCI images and their layers.

func (*Image) Image

func (i *Image) Image(h ociv1.Hash) (ociv1.Image, error)

Image returns the stored image with the supplied hash, if any.

func (*Image) Layer

func (i *Image) Layer(h ociv1.Hash) (ociv1.Layer, error)

Layer returns the stored layer with the supplied hash, if any.

func (*Image) WriteImage

func (i *Image) WriteImage(img ociv1.Image) error

WriteImage writes the supplied image to the store.

func (*Image) WriteLayer

func (i *Image) WriteLayer(l ociv1.Layer) error

WriteLayer writes the supplied layer to the store.

Directories

Path Synopsis
Package overlay implements an overlay based container store.
Package overlay implements an overlay based container store.
Package uncompressed implemented an uncompressed layer based container store.
Package uncompressed implemented an uncompressed layer based container store.

Jump to

Keyboard shortcuts

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