ocisif

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataContainerArtifactType string          = "application/vnd.sylabs.data-container.v1"
	EmptyConfigMediaType      types.MediaType = "application/vnd.oci.empty.v1+json"
)

ConfigMediaType custom media type.

View Source
const (
	// TODO - Replace when exported from SIF / oci-tools
	SquashfsLayerMediaType types.MediaType = "application/vnd.sylabs.image.layer.v1.squashfs"
)

Variables

View Source
var ErrFailedSquashfsConversion = errors.New("could not convert layer to squashfs")
View Source
var Ext3LayerMediaType types.MediaType = "application/vnd.sylabs.image.layer.v1.ext3"

Functions

func AddOverlay added in v4.2.0

func AddOverlay(imagePath string, overlayPath string) error

AddOverlay adds the provided ext3 overlay file at overlayPath to the OCI-SIF at imagePath, as a new image layer.

func DataContainerLayerOffset added in v4.2.0

func DataContainerLayerOffset(f *os.File) (int64, error)

func GetSingleImage

func GetSingleImage(fi *sif.FileImage) (v1.Image, error)

GetSingleImage returns a v1.Image from an OCI-SIF, that must contain a single image.

func HasOverlay added in v4.2.0

func HasOverlay(imagePath string) (bool, int64, error)

HasOverlay returns whether the OCI-SIF at imgPath has an ext3 writable final layer - an 'overlay'. If present, the offset of the overlay data in the OCI-SIF file is also returned.

func SealOverlay added in v4.2.0

func SealOverlay(imagePath, tmpDir string) error

SealOverlay converts an ext3 overlay into a r/o squashfs layer. If `tmpDir` is specified, then the temporary squashfs image will be created inside it. If tmpDir is the empty string, then temporary files will be created at the location returned by os.TempDir.

func SyncOverlay added in v4.2.0

func SyncOverlay(imagePath string) error

SyncOverlay synchronizes the digests of the overlay, stored in the OCI structures, with its true content.

func WriteDataContainerFromPath added in v4.2.0

func WriteDataContainerFromPath(path string, dst string, workDir string) error

WriteDataContainerFromPath takes a path to a directory or regular file, and writes a data container image populated with the directory/file to dest, as an OCI-SIF.

Types

type ImageWriter added in v4.2.0

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

func NewImageWriter added in v4.2.0

func NewImageWriter(src ggcrv1.Image, dest, workDir string, opts ...ImageWriterOpt) (*ImageWriter, error)

NewImageWriter returns a writer, which will write an OCI image into an OCI-SIF file.

func (*ImageWriter) Write added in v4.2.0

func (w *ImageWriter) Write() error

Write will write an image to an OCI-SIF file, applying relevant mutations set via options on the ImageWriter.

type ImageWriterOpt added in v4.2.0

type ImageWriterOpt func(*ImageWriter) error

func WithArtifactType added in v4.2.0

func WithArtifactType(v string) ImageWriterOpt

WithArtifactType says the image should be written with the artifactType field defined in the OCI v1.1.0 specification to v.

func WithSquash added in v4.2.0

func WithSquash(v bool) ImageWriterOpt

WithSquash sets a flag whether to squash to a single layer.

func WithSquashFSLayers added in v4.2.0

func WithSquashFSLayers(v bool) ImageWriterOpt

WithSquashFSLayers sets a flag whether to ensure layers are written as SquashFS.

Jump to

Keyboard shortcuts

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