oras

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PushExistsCheckEnvVar = "OCM_OCI_PUSH_EXISTS_CHECK"

PushExistsCheckEnvVar gates the optional HEAD pre-check performed before pushing a blob to an OCI registry. When set to a truthy value (parsed via strconv.ParseBool, e.g. "1", "true"), OrasPusher.Push calls repository.Exists() first and short-circuits with errdefs.ErrAlreadyExists if the blob is already present.

The check is opt-in because it adds an extra round-trip per blob and serialises Exists/Push pairs in the hot path of concurrent transfers (see PR #1676). Enable it when a registry's Push response is unreliable and the redundant HEAD is preferable to a failed upload.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(opts ClientOptions) *Client

func (*Client) Fetcher

func (c *Client) Fetcher(ctx context.Context, ref string) (Fetcher, error)

func (*Client) Lister

func (c *Client) Lister(ctx context.Context, ref string) (Lister, error)

func (*Client) Pusher

func (c *Client) Pusher(ctx context.Context, ref string) (Pusher, error)

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, ref string) (string, ociv1.Descriptor, error)

type ClientOptions

type ClientOptions struct {
	Client    *auth.Client
	PlainHTTP bool
	Logger    logging.Logger
	Lock      *locker.Locker
}

type Fetcher

type Fetcher interface {
	// Fetch the resource identified by the descriptor.
	Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)
}

Fetcher fetches content.

type Lister

type Lister interface {
	List(context.Context) ([]string, error)
}

type OrasFetcher

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

func (*OrasFetcher) Fetch

func (c *OrasFetcher) Fetch(ctx context.Context, desc ociv1.Descriptor) (io.ReadCloser, error)

type OrasLister

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

func (*OrasLister) List

func (c *OrasLister) List(ctx context.Context) ([]string, error)

type OrasPusher

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

func (*OrasPusher) Push

func (c *OrasPusher) Push(ctx context.Context, d ociv1.Descriptor, src Source) (retErr error)

type Pusher

type Pusher interface {
	// Push returns a push request for the given resource identified
	// by the descriptor and the given data source.
	Push(ctx context.Context, d ocispec.Descriptor, src Source) error
}

Pusher pushes content don't use write interface of containerd remotes.Pusher.

type Resolver

type Resolver interface {
	// Resolve attempts to resolve the reference into a name and descriptor.
	//
	// The argument `ref` should be a scheme-less URI representing the remote.
	// Structurally, it has a host and path. The "host" can be used to directly
	// reference a specific host or be matched against a specific handler.
	//
	// The returned name should be used to identify the referenced entity.
	// Depending on the remote namespace, this may be immutable or mutable.
	// While the name may differ from ref, it should itself be a valid ref.
	//
	// If the resolution fails, an error will be returned.
	Resolve(ctx context.Context, ref string) (name string, desc ocispec.Descriptor, err error)

	// Fetcher returns a new fetcher for the provided reference.
	// All content fetched from the returned fetcher will be
	// from the namespace referred to by ref.
	Fetcher(ctx context.Context, ref string) (Fetcher, error)

	// Pusher returns a new pusher for the provided reference
	// The returned Pusher should satisfy content.Ingester and concurrent attempts
	// to push the same blob using the Ingester API should result in ErrUnavailable.
	Pusher(ctx context.Context, ref string) (Pusher, error)

	Lister(ctx context.Context, ref string) (Lister, error)
}

Resolver provides remotes based on a locator.

type Source

type Source interface {
	Reader() (io.ReadCloser, error)
}

Jump to

Keyboard shortcuts

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