Documentation ¶
Index ¶
- type Option
- type Options
- type Registry
- type Repository
- type Spec
- func (spec *Spec) DeleteBlob(ctx context.Context, repo string, dgst digest.Digest) error
- func (spec *Spec) DeleteManifest(ctx context.Context, repo string, reference string) error
- func (spec *Spec) GetBlob(ctx context.Context, repo string, dgst digest.Digest) (cas.ReadCloser, error)
- func (spec *Spec) GetManifest(ctx context.Context, repo string, reference string) (cas.ReadCloser, error)
- func (spec *Spec) GetReferrers(ctx context.Context, repo string, dgst digest.Digest, artifactType string) ([]imgspecv1.Descriptor, error)
- func (spec *Spec) GetVersion(ctx context.Context) (string, error)
- func (spec *Spec) ListReferrers(ctx context.Context, repo string, dgst digest.Digest, artifactType string) ([]imgspecv1.Descriptor, error)
- func (spec *Spec) ListRepositories(opts ...distribution.ListOption) iter.Iterator[string]
- func (spec *Spec) ListTags(repo string, opts ...distribution.ListOption) iter.Iterator[string]
- func (spec *Spec) MountBlob(ctx context.Context, repo string, from string, dgst digest.Digest) (bool, error)
- func (spec *Spec) PushBlob(ctx context.Context, repo string, getter cas.ReadCloserGetter) error
- func (spec *Spec) PushBlobChunked(ctx context.Context, repo string, chunkSize int64) (distribution.BlobWriteCloser, error)
- func (spec *Spec) PushBlobChunkedResume(ctx context.Context, repo string, chunkSize int64, id string, offset int64) (distribution.BlobWriteCloser, error)
- func (spec *Spec) PushManifest(ctx context.Context, repo string, r cas.Reader, tags ...string) error
- func (spec *Spec) StatBlob(ctx context.Context, repo string, dgst digest.Digest) (imgspecv1.Descriptor, error)
- func (spec *Spec) StatManifest(ctx context.Context, repo string, reference string) (imgspecv1.Descriptor, error)
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 ¶
WithHTTPClient sets the HTTP client for the registry.
type Options ¶
Options is the structure of the optional parameters.
func MakeOptions ¶
MakeOptions returns the options with all optional parameters applied.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
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) 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 ¶
NewSpec creates a client which implements distribution-spec interface to the remote registry with the given "ctx".
func (*Spec) DeleteBlob ¶
DeleteBlob deletes the blob with the given digest in the given repository.
func (*Spec) DeleteManifest ¶
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 ¶
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 ¶
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.