oci

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("content not found")
)

Functions

func AddMirrorConfiguration

func AddMirrorConfiguration(ctx context.Context, fs afero.Fs, configPath string, registryURLs, mirrorURLs []url.URL, resolveTags, appendToBackup bool) error

Refer to containerd registry configuration documentation for more information about required configuration. https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration https://github.com/containerd/containerd/blob/main/docs/hosts.md#registry-configuration---examples

func DetermineMediaType added in v0.0.24

func DetermineMediaType(b []byte) (string, error)

func WalkImage added in v0.0.24

func WalkImage(ctx context.Context, client Client, img Image) ([]string, error)

Types

type Client

type Client interface {
	// Name returns the name of the Client implementation.
	Name() string

	// Verify checks that all expected configuration is set.
	Verify(ctx context.Context) error

	// Subscribe will notify for any image events ocuring in the store backend.
	Subscribe(ctx context.Context) (<-chan ImageEvent, <-chan error, error)

	// ListImages returns a list of all local images.
	ListImages(ctx context.Context) ([]Image, error)

	// Resolve returns the digest for the tagged image name reference.
	// The ref is expected to be in the format `registry/name:tag`.
	Resolve(ctx context.Context, ref string) (digest.Digest, error)

	// Size returns the content byte size for the given digest.
	// Will return ErrNotFound if the digest cannot be found.
	Size(ctx context.Context, dgst digest.Digest) (int64, error)

	// GetManifest returns the manifest content for the given digest.
	// Will return ErrNotFound if the digest cannot be found.
	GetManifest(ctx context.Context, dgst digest.Digest) ([]byte, string, error)

	// GetBlob returns a stream of the blob content for the given digest.
	// Will return ErrNotFound if the digest cannot be found.
	GetBlob(ctx context.Context, dgst digest.Digest) (io.ReadSeekCloser, error)
}

type Containerd

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

func NewContainerd

func NewContainerd(sock, namespace, registryConfigPath string, registries []url.URL, opts ...Option) (*Containerd, error)

func (*Containerd) Client

func (c *Containerd) Client() (*containerd.Client, error)

func (*Containerd) GetBlob

func (c *Containerd) GetBlob(ctx context.Context, dgst digest.Digest) (io.ReadSeekCloser, error)

func (*Containerd) GetManifest

func (c *Containerd) GetManifest(ctx context.Context, dgst digest.Digest) ([]byte, string, error)

func (*Containerd) ListImages

func (c *Containerd) ListImages(ctx context.Context) ([]Image, error)

func (*Containerd) Name

func (c *Containerd) Name() string

func (*Containerd) Resolve

func (c *Containerd) Resolve(ctx context.Context, ref string) (digest.Digest, error)

func (*Containerd) Size

func (c *Containerd) Size(ctx context.Context, dgst digest.Digest) (int64, error)

func (*Containerd) Subscribe

func (c *Containerd) Subscribe(ctx context.Context) (<-chan ImageEvent, <-chan error, error)

func (*Containerd) Verify

func (c *Containerd) Verify(ctx context.Context) error

type EventType

type EventType string
const (
	CreateEvent EventType = "CREATE"
	UpdateEvent EventType = "UPDATE"
	DeleteEvent EventType = "DELETE"
)

type Image

type Image struct {
	Name       string
	Registry   string
	Repository string
	Tag        string
	Digest     digest.Digest
}

func NewImage

func NewImage(name, registry, repository, tag string, dgst digest.Digest) (Image, error)

func Parse

func Parse(s string, extraDgst digest.Digest) (Image, error)

func (Image) IsLatestTag

func (i Image) IsLatestTag() bool

func (Image) String

func (i Image) String() string

func (Image) TagName

func (i Image) TagName() (string, bool)

type ImageEvent

type ImageEvent struct {
	Image Image
	Type  EventType
}

type Memory added in v0.0.24

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

func NewMemory added in v0.0.24

func NewMemory() *Memory

func (*Memory) AddBlob added in v0.0.24

func (m *Memory) AddBlob(b []byte, dgst digest.Digest)

func (*Memory) AddImage added in v0.0.24

func (m *Memory) AddImage(img Image)

func (*Memory) GetBlob added in v0.0.24

func (m *Memory) GetBlob(ctx context.Context, dgst digest.Digest) (io.ReadSeekCloser, error)

func (*Memory) GetManifest added in v0.0.24

func (m *Memory) GetManifest(ctx context.Context, dgst digest.Digest) ([]byte, string, error)

func (*Memory) ListImages added in v0.0.24

func (m *Memory) ListImages(ctx context.Context) ([]Image, error)

func (*Memory) Name added in v0.0.24

func (m *Memory) Name() string

func (*Memory) Resolve added in v0.0.24

func (m *Memory) Resolve(ctx context.Context, ref string) (digest.Digest, error)

func (*Memory) Size added in v0.0.24

func (m *Memory) Size(ctx context.Context, dgst digest.Digest) (int64, error)

func (*Memory) Subscribe added in v0.0.24

func (m *Memory) Subscribe(ctx context.Context) (<-chan ImageEvent, <-chan error, error)

func (*Memory) Verify added in v0.0.24

func (m *Memory) Verify(ctx context.Context) error

type Option added in v0.0.22

type Option func(*Containerd)

func WithContentPath added in v0.0.22

func WithContentPath(path string) Option

type UnknownDocument

type UnknownDocument struct {
	MediaType string `json:"mediaType"`
	specs.Versioned
}

Jump to

Keyboard shortcuts

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