Documentation ¶
Index ¶
- type Client
- func (c *Client) DeleteData(ctx context.Context, name, tag string) error
- 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, int64, error)
- func (c *Client) IsCached(ctx context.Context, name, tag string) (bool, error)
- func (c *Client) PushData(ctx context.Context, data io.ReadCloser, mediaType, name, tag string) (string, int64, error)
- func (c *Client) WithTransport(ctx context.Context) Option
- type ClientOptsFunc
- 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 { Client client.Client OCIRepositoryAddr string InsecureSkipVerify bool Namespace string CertSecretName string // contains filtered or unexported fields }
Client implements the caching layer and the OCI layer.
func NewClient ¶
func NewClient(ociAddress string, opts ...ClientOptsFunc) *Client
NewClient creates a new OCI Client.
func (*Client) DeleteData ¶
DeleteData removes a specific tag from the cache.
func (*Client) FetchDataByDigest ¶
FetchDataByDigest returns a reader for a given digest.
func (*Client) FetchDataByIdentity ¶
func (c *Client) FetchDataByIdentity(ctx context.Context, name, tag string) (io.ReadCloser, string, int64, 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 ClientOptsFunc ¶
type ClientOptsFunc func(opts *Client)
ClientOptsFunc options are used to leave the cache backwards compatible. If the certificate isn't defined, we will use `WithInsecure`.
func WithCertificateSecret ¶
func WithCertificateSecret(name string) ClientOptsFunc
WithCertificateSecret defines the name of the secret holding the certificates.
func WithClient ¶
func WithClient(client client.Client) ClientOptsFunc
WithClient sets up certificates for the client.
func WithInsecureSkipVerify ¶
func WithInsecureSkipVerify(value bool) ClientOptsFunc
WithInsecureSkipVerify sets up certificates for the client.
func WithNamespace ¶
func WithNamespace(namespace string) ClientOptsFunc
WithNamespace sets up certificates for the client.
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.ResourceReference 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.