oras

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SifLayerMediaTypeV1 is the mediaType for the "layer" which contains the actual SIF file
	SifLayerMediaTypeV1 = "application/vnd.sylabs.sif.layer.v1.sif"

	// SifLayerMediaTypeProto is the mediaType from prototyping and Singularity
	// <3.7 which unfortunately includes a typo and doesn't have a version suffix
	// See: https://github.com/hpcng/singularity/issues/4437
	SifLayerMediaTypeProto = "appliciation/vnd.sylabs.sif.layer.tar"
)
View Source
const (

	// SifConfigMediaTypeV1 is the config descriptor mediaType for a SIF image.
	SifConfigMediaTypeV1 = "application/vnd.sylabs.sif.config.v1+json"
)

Variables

This section is empty.

Functions

func DownloadImage

func DownloadImage(_ context.Context, path, ref string, ociAuth *ocitypes.DockerAuthConfig, pb *progress.DownloadBar) error

DownloadImage downloads a SIF image specified by an oci reference to a file using the included credentials

FIXME: use context for cancellation.

func ImageHash

func ImageHash(filePath string) (ggcrv1.Hash, error)

ImageDigest returns the digest for a file

func Pull

func Pull(ctx context.Context, imgCache *cache.Handle, pullFrom, tmpDir string, ociAuth *ocitypes.DockerAuthConfig) (imagePath string, err error)

Pull will pull an oras image to the cache or direct to a temporary file if cache is disabled

func PullToFile

func PullToFile(ctx context.Context, imgCache *cache.Handle, pullTo, pullFrom string, ociAuth *ocitypes.DockerAuthConfig) (imagePath string, err error)

PullToFile will pull an oras image to the specified location, through the cache, or directly if cache is disabled

func RefHash

func RefHash(_ context.Context, ref string, ociAuth *ocitypes.DockerAuthConfig) (ggcrv1.Hash, error)

RefHash returns the digest of the SIF layer of the OCI manifest for supplied ref

FIXME: use context for cancellation.

func UploadImage

func UploadImage(_ context.Context, path, ref string, ociAuth *ocitypes.DockerAuthConfig) error

UploadImage uploads the image specified by path and pushes it to the provided oci reference, it will use credentials if supplied

FIXME: use context for cancellation.

Types

type SifImage

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

SifImage implements a go-containerregistry v1.Image representing an ORAS / OCI artifact of a single SIF image.

func NewImageFromSIF

func NewImageFromSIF(file string, layerMediaType types.MediaType) (*SifImage, error)

func (*SifImage) ConfigFile

func (si *SifImage) ConfigFile() (*v1.ConfigFile, error)

ConfigFile returns the hash of the image's config file, also known as the Image ID.

func (*SifImage) ConfigName

func (si *SifImage) ConfigName() (v1.Hash, error)

ConfigName returns the hash of the image's config file, also known as the Image ID.

func (*SifImage) Digest

func (si *SifImage) Digest() (v1.Hash, error)

Digest returns the sha256 of this image's manifest.

func (*SifImage) LayerByDiffID

func (si *SifImage) LayerByDiffID(hash v1.Hash) (v1.Layer, error)

LayerByDiffID is an analog to LayerByDigest, looking up by "diff id" (the uncompressed hash).

func (*SifImage) LayerByDigest

func (si *SifImage) LayerByDigest(hash v1.Hash) (v1.Layer, error)

LayerByDigest returns a Layer for interacting with a particular layer of the image, looking it up by "digest" (the compressed hash).

func (*SifImage) Layers

func (si *SifImage) Layers() ([]v1.Layer, error)

Layers returns the ordered collection of filesystem layers that comprise this image. The order of the list is oldest/base layer first, and most-recent/top layer last.

func (*SifImage) Manifest

func (si *SifImage) Manifest() (*v1.Manifest, error)

Manifest returns this image's Manifest object.

func (*SifImage) MediaType

func (si *SifImage) MediaType() (types.MediaType, error)

MediaType of this image's manifest.

func (*SifImage) RawConfigFile

func (si *SifImage) RawConfigFile() ([]byte, error)

RawConfigFile returns the serialized bytes of ConfigFile().

func (*SifImage) RawManifest

func (si *SifImage) RawManifest() ([]byte, error)

RawManifest returns the serialized bytes of Manifest()

func (*SifImage) Size

func (si *SifImage) Size() (int64, error)

Size returns the size of the manifest.

type SifLayer

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

SifLayer implements a go-containerregistry v1.Layer backed by a SIF file, for ORAS / OCI artifact usage.

func NewLayerFromSIF

func NewLayerFromSIF(file string, mt types.MediaType) (*SifLayer, error)

NewLayerFromSIF creates a new layer, backed by file, with mt as the MediaType. The MediaType should always be set SifLayerMediaTypeV1 in production. It is configurable so that we can implement tests which use the old prototype media value.

func (*SifLayer) Compressed

func (sl *SifLayer) Compressed() (io.ReadCloser, error)

func (*SifLayer) DiffID

func (sl *SifLayer) DiffID() (v1.Hash, error)

func (*SifLayer) Digest

func (sl *SifLayer) Digest() (v1.Hash, error)

func (*SifLayer) MediaType

func (sl *SifLayer) MediaType() (types.MediaType, error)

func (*SifLayer) Size

func (sl *SifLayer) Size() (int64, error)

func (*SifLayer) Uncompressed

func (sl *SifLayer) Uncompressed() (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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