Documentation ¶
Index ¶
- type Client
- func (c *Client) FetchDataByDigest(ctx context.Context, name, digest string) (io.ReadCloser, error)
- func (c *Client) FetchDataByIdentity(ctx context.Context, name, tag string) (io.ReadCloser, string, error)
- func (c *Client) IsCached(ctx context.Context, name, tag string) (bool, error)
- func (c *Client) PushData(ctx context.Context, data io.ReadCloser, name, tag string) (string, error)
- type Option
- type Repository
- func (r *Repository) FetchBlob(digest string) (io.ReadCloser, error)
- func (r *Repository) FetchManifest(reference string, filters []string) (*ocispec.Manifest, []byte, error)
- func (r *Repository) PushStreamBlob(blob io.ReadCloser, mediaType string) (*ocispec.Descriptor, error)
- func (r *Repository) PushStreamingImage(reference string, reader io.ReadCloser, mediaType string, ...) (*v1.Manifest, error)
- type ResourceOptions
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
OCIRepositoryAddr string
}
Client implements the caching layer and the OCI layer.
func (*Client) FetchDataByDigest ¶
func (*Client) FetchDataByIdentity ¶
func (c *Client) FetchDataByIdentity(ctx context.Context, name, tag string) (io.ReadCloser, string, error)
FetchDataByIdentity fetches an existing resource. Errors if there is no resource available. It's advised to call IsCached before fetching. Returns the digest of the resource alongside the data for further processing.
type Option ¶
type Option func(o *options) error
Option is a functional option for Repository.
func WithInsecure ¶ added in v0.1.0
func WithInsecure() Option
WithInsecure sets up the registry to use HTTP with --insecure.
type Repository ¶
type Repository struct { ociname.Repository // contains filtered or unexported fields }
Repository is a wrapper around go-container registry's name.Repository. It provides a few convenience methods for interacting with OCI registries.
func NewRepository ¶
func NewRepository(repositoryName string, opts ...Option) (*Repository, error)
NewRepository returns a new Repository. It points to the given remote repository. It accepts a list of options to configure the repository and the underlying remote client.
func (*Repository) FetchBlob ¶
func (r *Repository) FetchBlob(digest string) (io.ReadCloser, error)
FetchBlob fetches a blob from the repository.
func (*Repository) FetchManifest ¶
func (r *Repository) FetchManifest(reference string, filters []string) (*ocispec.Manifest, []byte, error)
FetchManifest fetches a manifest from the repository. It returns the manifest as an oci.Manifest struct and the raw manifest as a byte slice. The oci.Manifest struct can be used to retrieve the layers digests. Optionally, the manifest annotations can be verified against the given slice of strings keys.
func (*Repository) PushStreamBlob ¶
func (r *Repository) PushStreamBlob(blob io.ReadCloser, mediaType string) (*ocispec.Descriptor, error)
PushStreamBlob pushes by streaming a blob to the repository. It accepts an io.ReadCloser interface. A media type can be specified to override the default media type. Default media type is "application/vnd.oci.image.layer.v1.tar+gzip".
func (*Repository) PushStreamingImage ¶
func (r *Repository) PushStreamingImage(reference string, reader io.ReadCloser, mediaType string, annotations map[string]string) (*v1.Manifest, error)
PushStreamingImage pushes a reader to the repository as a streaming OCI image. It accepts a media type and a byte slice as the blob. Default media type is "application/vnd.oci.image.layer.v1.tar+gzip". Annotations can be passed to the image manifest.
type ResourceOptions ¶
type ResourceOptions struct { ComponentVersion *v1alpha1.ComponentVersion Resource v1alpha1.ResourceRef Owner metav1.Object SnapshotName string }
ResourceOptions contains all parameters necessary to fetch / push resources.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier is a wrapper around go-digest.Verifier
func NewVerifier ¶
NewVerifier returns a new Verifier. It accepts a string, which is the digest of the blob to verify. The digest must be of the form <algorithm>:<hex>. The returned Verifier can be used to verify the blob.