remote

package
v0.0.0-...-8de25fd Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is the optional parameter setting method.

func WithHTTPClient

func WithHTTPClient(client *remote.Client) Option

WithHTTPClient sets the HTTP client for the registry.

type Options

type Options struct {
	Client *remote.Client
}

Options is the structure of the optional parameters.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns the default options.

func MakeOptions

func MakeOptions(opts ...Option) *Options

MakeOptions returns the options with all optional parameters applied.

type Registry

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

func NewRegistry

func NewRegistry(ctx context.Context, name ocispecname.Registry, opts ...Option) (*Registry, error)

func (*Registry) ListRepositories

func (r *Registry) ListRepositories(opts ...distribution.ListOption) iter.Iterator[*Repository]

ListRepositories lists the repositories.

func (*Registry) Name

func (r *Registry) Name() ocispecname.Registry

Name returns the name of the registry.

func (*Registry) Ping

func (r *Registry) Ping(ctx context.Context) error

Ping checks registry is accessible.

func (*Registry) Repository

func (r *Registry) Repository(path string) *Repository

Repository returns the Repository by the given path which is the repository name.

NOTE: Invalid "path" will cause panic.

type Repository

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

func NewRepository

func NewRepository(ctx context.Context, name ocispecname.Repository, opts ...Option) (*Repository, error)

func (*Repository) Blobs

func (r *Repository) Blobs() distribution.BlobStore

Blobs returns a reference to this repository's blob storage.

func (*Repository) Manifests

func (r *Repository) Manifests() distribution.ManifestStore

Manifests returns a reference to this repository's manifest storage.

func (*Repository) Name

func (r *Repository) Name() ocispecname.Repository

Name returns the name of the repository.

func (*Repository) Registry

func (r *Repository) Registry() *Registry

Registry returns the registry of the repository.

func (*Repository) Tags

func (r *Repository) Tags() distribution.TagStore

Tags returns a reference to this repository's tag storage.

type Spec

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

func NewSpec

func NewSpec(ctx context.Context, name ocispecname.Registry, opts ...Option) (*Spec, error)

NewSpec creates a client which implements distribution-spec interface to the remote registry with the given "ctx".

func (*Spec) DeleteBlob

func (spec *Spec) DeleteBlob(ctx context.Context, repo string, dgst digest.Digest) error

DeleteBlob deletes the blob with the given digest in the given repository.

func (*Spec) DeleteManifest

func (spec *Spec) DeleteManifest(ctx context.Context, repo string, reference string) error

DeleteManifest deletes the manifest with the given digest in the given repository.

func (*Spec) GetBlob

func (spec *Spec) GetBlob(ctx context.Context, repo string, dgst digest.Digest) (cas.ReadCloser, error)

GetBlob returns the content of the blob with the given digest.

func (*Spec) GetManifest

func (spec *Spec) GetManifest(ctx context.Context, repo string, reference string) (cas.ReadCloser, error)

GetManifest returns the content of the manifest with the given reference.

func (*Spec) GetReferrers

func (spec *Spec) GetReferrers(ctx context.Context, repo string, dgst digest.Digest, artifactType string) ([]imgspecv1.Descriptor, error)

GetReferrers returns descriptors of referrers with the given "dgst" and "artifactType" used to filter artifacts.

If the Referrers API returns a 404, the client MUST fallback to pulling the Referrers Tag Schema. The response SHOULD be an image index with the same content that would be expected from the Referrers API. If the response to the Referrers API is a 404, and the Referrers Tag Schema does not return a valid image index, the client SHOULD assume there are no referrers to the manifest.

func (*Spec) GetVersion

func (spec *Spec) GetVersion(ctx context.Context) (string, error)

GetVersion checks the registry accessible and returns the properties of the registry.

func (*Spec) ListReferrers

func (spec *Spec) ListReferrers(ctx context.Context, repo string, dgst digest.Digest, artifactType string) ([]imgspecv1.Descriptor, error)

Referrers returns an iterator that can be used to iterate over all the manifests that have the given digest as their Subject.

If "artifactType" is specified, the results will be restricted to only manifests with that type.

func (*Spec) ListRepositories

func (spec *Spec) ListRepositories(opts ...distribution.ListOption) iter.Iterator[string]

ListRepositories returns an iterator that can be used to iterate over all the repositories in the registry in order.

func (*Spec) ListTags

func (spec *Spec) ListTags(repo string, opts ...distribution.ListOption) iter.Iterator[string]

ListTags returns an iterator that can be used to iterate over all the tags in the given repository in order.

func (*Spec) MountBlob

func (spec *Spec) MountBlob(ctx context.Context, repo string, from string, dgst digest.Digest) (bool, error)

MountBlob makes a blob with the given digest that's in "from" repository available in "repo" repository and returns mounted successfully or not.

As distribution-spec specified:

"Alternatively, if a registry does not support cross-repository mounting or is unable to mount the requested blob, it SHOULD return a 202. This indicates that the upload session has begun and that the client MAY proceed with the upload."

So the returns composites as follow:

  • "true, nil" means mount succeed.
  • "false, nil" means mount is unsupported.
  • "false, err" means mount failed with unexpected error.

func (*Spec) PushBlob

func (spec *Spec) PushBlob(ctx context.Context, repo string, getter cas.ReadCloserGetter) error

PushBlob pushes a blob monolithically to the given repository, reading the descriptor and content from "getter".

Push is done by conventional 2-step monolithic upload instead of a single `POST` request for better overall performance. It also allows early fail on authentication errors.

func (*Spec) PushBlobChunked

func (spec *Spec) PushBlobChunked(ctx context.Context, repo string, chunkSize int64) (distribution.BlobWriteCloser, error)

PushBlobChunked starts to push a blob to the given repository. The returned [BlobWriteCloser] can be used to stream the upload and resume on temporary errors.

The chunkSize parameter provides a hint for the chunk size to use when writing to the registry. If it's zero, a suitable default will be chosen. It might be larger if the underlying registry requires that.

The context remains active as long as the BlobWriteCloser is around: if it's canceled, it should cause any blocked BlobWriteCloser operations to terminate.

func (*Spec) PushBlobChunkedResume

func (spec *Spec) PushBlobChunkedResume(ctx context.Context, repo string, chunkSize int64, id string, offset int64) (distribution.BlobWriteCloser, error)

PushBlobChunkedResume resumes a previous push of a blob started with PushBlobChunked. The id should be the value returned from [BlobWriteCloser.ID] from the previous push. and the offset should be the value returned from [BlobWriteCloser.Size].

The offset and chunkSize should similarly be obtained from the previous [BlobWriterCloser] via the [BlobWriteCloser.Size] and [BlobWriteCloser.ChunkSize] methods. Alternatively, set offset to -1 to continue where the last write left off, and to only use chunkSize as a hint like in PushBlobChunked.

The context remains active as long as the BlobWriteCloser is around: if it's canceled, it should cause any blocked BlobWriteCloser operations to terminate.

func (*Spec) PushManifest

func (spec *Spec) PushManifest(ctx context.Context, repo string, r cas.Reader, tags ...string) error

PushManifest pushes a manifest with the given descriptor and tags.

func (*Spec) StatBlob

func (spec *Spec) StatBlob(ctx context.Context, repo string, dgst digest.Digest) (imgspecv1.Descriptor, error)

StatBlob returns the descriptor of the blob with the given digest.

func (*Spec) StatManifest

func (spec *Spec) StatManifest(ctx context.Context, repo string, reference string) (imgspecv1.Descriptor, error)

StatManifest returns the descriptor of the manifest with the given reference.

Jump to

Keyboard shortcuts

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