resolver

package
v0.0.0-...-fc95bb0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Containerd

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

Containerd resolver to push to/pull from containerd. Finalize releases the lease taken when the resolver was created, so a Containerd is good for one unit of work and should be discarded afterwards.

func NewContainerd

func NewContainerd(ctx context.Context, address, namespace string) (context.Context, *Containerd, error)

NewContainerd create a containerd resolver given the containerd address and namespace (optional)

func NewContainerdWithClient

func NewContainerdWithClient(ctx context.Context, client *containerd.Client) (context.Context, *Containerd, error)

NewContainerdWithClient create a containerd resolver with an existing containerd client connection

func (*Containerd) Context

func (d *Containerd) Context() context.Context

func (*Containerd) Exists

func (d *Containerd) Exists(ctx context.Context, desc ocispec.Descriptor) (bool, error)

Exists report whether the content named by desc is already in the store.

func (*Containerd) Fetch

func (d *Containerd) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)

Fetch return a reader for the content named by desc.

func (*Containerd) Finalize

func (d *Containerd) Finalize(ctx context.Context) error

func (*Containerd) Push

func (d *Containerd) Push(ctx context.Context, expected ocispec.Descriptor, r io.Reader) error

Push write the content to the store. A manifest or index is also given the containerd GC labels that keep its children from being collected; without them containerd is free to remove blobs this manifest still references.

func (*Containerd) Resolve

func (d *Containerd) Resolve(ctx context.Context, ref string) (ocispec.Descriptor, error)

Resolve look up the image by reference and return the descriptor it points at.

func (*Containerd) Tag

func (d *Containerd) Tag(ctx context.Context, desc ocispec.Descriptor, ref string) error

Tag point the given reference at desc, creating the image if it is not there yet.

func (*Containerd) Target

func (d *Containerd) Target(_ context.Context, _ string) (oras.Target, error)

Target returns the containerd store, which serves every reference it holds.

type Directory

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

Directory resolver that reads and writes an OCI image layout in a directory.

func NewDirectory

func NewDirectory(ctx context.Context, dir string) (context.Context, *Directory, error)

NewDirectory create a Directory resolver over dir, creating it if needed.

func (*Directory) Context

func (d *Directory) Context() context.Context

func (*Directory) Finalize

func (d *Directory) Finalize(_ context.Context) error

func (*Directory) Target

func (d *Directory) Target(_ context.Context, _ string) (oras.Target, error)

Target returns the image layout, which serves every reference it holds.

type Registry

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

Registry resolver that reads and writes an OCI registry.

func NewRegistry

func NewRegistry(ctx context.Context) (context.Context, *Registry, error)

NewRegistry create a Registry resolver that reaches the registry over HTTPS.

func NewRegistryWithOpts

func NewRegistryWithOpts(ctx context.Context, opts ...RegistryOpt) (context.Context, *Registry, error)

NewRegistryWithOpts create a Registry resolver configured by opts.

func (*Registry) Context

func (r *Registry) Context() context.Context

func (*Registry) Finalize

func (r *Registry) Finalize(_ context.Context) error

func (*Registry) Target

func (r *Registry) Target(_ context.Context, ref string) (oras.Target, error)

Target returns a target bound to the repository named by ref.

type RegistryOpt

type RegistryOpt func(*registryOpts)

RegistryOpt configures a Registry created by NewRegistryWithOpts.

func WithPlainHTTP

func WithPlainHTTP() RegistryOpt

WithPlainHTTP directs the resolver to contact the registry over HTTP rather than HTTPS, for a registry served without TLS such as a lab-local or test registry.

type Resolver

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

Resolver serves a target the caller already holds.

func NewResolver

func NewResolver(ctx context.Context, target oras.Target) (context.Context, *Resolver, error)

NewResolver create a Resolver that hands out the given target for every reference.

func (*Resolver) Context

func (r *Resolver) Context() context.Context

func (*Resolver) Finalize

func (r *Resolver) Finalize(_ context.Context) error

func (*Resolver) Target

func (r *Resolver) Target(_ context.Context, _ string) (oras.Target, error)

type ResolverCloser

type ResolverCloser interface {
	// Target returns the target that reads and writes the given reference.
	Target(ctx context.Context, ref string) (oras.Target, error)
	// Context returns the context the resolver was created with.
	Context() context.Context
	// Finalize releases anything the resolver is holding, such as a lease.
	Finalize(ctx context.Context) error
}

ResolverCloser hands out oras targets for references and releases whatever it holds when done. One ResolverCloser can serve several references; Target is what binds it to a particular one, because an oras target addresses a single repository.

Jump to

Keyboard shortcuts

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