sif

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMatch         = errors.New("no match found")
	ErrMultipleMatches = errors.New("multiple matches found")
)

Functions

func ImageIndexFromFileImage deprecated

func ImageIndexFromFileImage(fi *sif.FileImage) (v1.ImageIndex, error)

ImageIndexFromFileImage is a convenience function which constructs an OCIFileImage from a sif.FileImage, and returns its RootIndex as a v1.ImageIndex.

Deprecated: Use OCIFileImage.RootIndex instead. ImageIndexFromFileImage will be removed in a future version.

func Update deprecated added in v0.11.0

func Update(fi *sif.FileImage, ii v1.ImageIndex, opts ...UpdateOpt) error

Update is a convenience function, for backward compatibility, which calls OCIFileImage.UpdateRootIndex against the sif.FileImage fi.

Deprecated: Use OCIFileImage.UpdateRootIndex instead.

func Write

func Write(path string, ii v1.ImageIndex, opts ...WriteOpt) error

Write constructs a SIF at path from an ImageIndex, which becomes the RootIndex in the SIF.

By default, the SIF is created with the exact number of descriptors required to represent ii. To include spare descriptor capacity, consider using OptWriteWithSpareDescriptorCapacity.

Types

type AppendOpt added in v0.14.0

type AppendOpt func(*appendOpts) error

AppendOpt are used to specify options to apply when appending to a SIF.

func OptAppendReference added in v0.14.0

func OptAppendReference(r name.Reference) AppendOpt

OptAppendReference sets the reference to be set for the appended item in the RootIndex. The reference is added as an `org.opencontainers.image.ref.name` in the RootIndex.

func OptAppendTempDir added in v0.14.0

func OptAppendTempDir(d string) AppendOpt

OptAppendTempDir sets the directory to use for temporary files. If not set, the directory returned by os.TempDir is used.

type Layer added in v0.7.0

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

func (*Layer) Compressed added in v0.7.0

func (l *Layer) Compressed() (io.ReadCloser, error)

Compressed returns an io.ReadCloser for the compressed layer contents.

func (*Layer) Descriptor added in v0.7.0

func (l *Layer) Descriptor() (*v1.Descriptor, error)

Descriptor returns the original descriptor from an image manifest. See partial.Descriptor.

func (*Layer) DiffID added in v0.7.0

func (l *Layer) DiffID() (v1.Hash, error)

DiffID returns the Hash of the uncompressed layer.

func (*Layer) Digest added in v0.7.0

func (l *Layer) Digest() (v1.Hash, error)

Digest returns the Hash of the compressed layer.

func (*Layer) MediaType added in v0.7.0

func (l *Layer) MediaType() (types.MediaType, error)

MediaType returns the media type of the Layer.

func (*Layer) Offset added in v0.7.0

func (l *Layer) Offset() (int64, error)

Offset returns the offset within the SIF image of the Layer.

func (*Layer) Size added in v0.7.0

func (l *Layer) Size() (int64, error)

Size returns the compressed size of the Layer.

func (*Layer) Uncompressed added in v0.7.0

func (l *Layer) Uncompressed() (io.ReadCloser, error)

Uncompressed returns an io.ReadCloser for the uncompressed layer contents.

type OCIFileImage added in v0.14.0

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

OCIFileImage represents a Singularity Image Format (SIF) file containing OCI artifacts.

func FromFileImage added in v0.14.0

func FromFileImage(fi *sif.FileImage) (*OCIFileImage, error)

FromFileImage constructs an extended oci-tools OCIFileImage, with OCI specific functionality, from a generic sif.FileImage.

func (*OCIFileImage) AppendImage added in v0.14.0

func (f *OCIFileImage) AppendImage(img v1.Image, opts ...AppendOpt) error

AppendImage appends an image to the SIF f, updating the RootIndex to reference it.

func (*OCIFileImage) AppendIndex added in v0.14.0

func (f *OCIFileImage) AppendIndex(ii v1.ImageIndex, opts ...AppendOpt) error

AppendIndex appends an index to the SIF f, updating the RootIndex to reference it.

func (*OCIFileImage) Blob added in v0.14.0

func (f *OCIFileImage) Blob(h v1.Hash) (io.ReadCloser, error)

Blob returns a ReadCloser that reads the blob with the supplied digest.

func (*OCIFileImage) Bytes added in v0.14.0

func (f *OCIFileImage) Bytes(h v1.Hash) ([]byte, error)

Bytes returns the bytes of the blob with the supplied digest.

func (*OCIFileImage) FindManifests added in v0.16.0

func (f *OCIFileImage) FindManifests(m match.Matcher, _ ...Option) ([]v1.Descriptor, error)

FindManifests finds the manifests stored in f that are selected by m. If m is nil, all manifests are selected.

func (*OCIFileImage) Image added in v0.14.0

func (f *OCIFileImage) Image(m match.Matcher, _ ...Option) (v1.Image, error)

Image returns a single Image stored in f, that is selected by m. If m is nil, all manifests are selected. If more than one image matches, an error wrapping ErrMultipleMatches is returned. If no image matches, an error wrapping ErrNoMatch is returned.

func (*OCIFileImage) Index added in v0.14.0

func (f *OCIFileImage) Index(m match.Matcher, _ ...Option) (v1.ImageIndex, error)

Index returns a single ImageIndex stored in f, that is selected by m. If m is nil, all manifests are selected. If more than one index matches, an error wrapping ErrMultipleMatches is returned. If no index matches, an error wrapping ErrNoMatch is returned.

func (*OCIFileImage) Offset added in v0.14.0

func (f *OCIFileImage) Offset(h v1.Hash) (int64, error)

Offset returns the offset within the SIF image of the blob with the supplied digest.

func (*OCIFileImage) RemoveBlob added in v0.14.0

func (f *OCIFileImage) RemoveBlob(hash v1.Hash) error

RemoveBlob removes a blob from the SIF f, without modifying the rootIndex.

func (*OCIFileImage) RemoveManifests added in v0.14.0

func (f *OCIFileImage) RemoveManifests(matcher match.Matcher) error

RemoveManifests modifies the SIF file associated with f so that its RootIndex no longer holds manifests selected by matcher. If m is nil, all manifests are selected. Any blobs in the SIF that are no longer referenced are removed from the SIF.

func (*OCIFileImage) ReplaceImage added in v0.14.0

func (f *OCIFileImage) ReplaceImage(img v1.Image, matcher match.Matcher, opts ...AppendOpt) error

ReplaceImage writes img to the SIF, replacing any existing manifest that is selected by the matcher. If m is nil, all manifests are selected. Any blobs in the SIF that are no longer referenced are removed from the SIF.

func (*OCIFileImage) ReplaceIndex added in v0.14.0

func (f *OCIFileImage) ReplaceIndex(ii v1.ImageIndex, matcher match.Matcher, opts ...AppendOpt) error

ReplaceIndex writes ii to the SIF, replacing any existing manifest that is selected by the matcher. If m is nil, all manifests are selected. Any blobs in the SIF that are no longer referenced are removed from the SIF.

func (*OCIFileImage) RootIndex added in v0.14.0

func (f *OCIFileImage) RootIndex() (v1.ImageIndex, error)

RootIndex returns the RootIndex of f as a v1.ImageIndex.

func (*OCIFileImage) UpdateRootIndex added in v0.14.0

func (f *OCIFileImage) UpdateRootIndex(ii v1.ImageIndex, opts ...UpdateOpt) error

UpdateRootIndex modifies the SIF file associated with f so that it holds the content of ImageIndex ii. The RootIndex of the SIF is replaced with ii. Any blobs in the SIF that are not referenced in ii are removed from the SIF. Any blobs that are referenced in ii but not present in the SIF are added to the SIF.

UpdateRootIndex may create one or more temporary files during the update process. By default, the directory returned by os.TempDir is used. To override this, consider using OptUpdateTmpDir.

func (*OCIFileImage) WriteBlob added in v0.14.0

func (f *OCIFileImage) WriteBlob(r io.Reader) error

WriteBlob writes a blob to the SIF f, as a DataOCIBlob descriptor.

type Option added in v0.14.0

type Option func(*options) error

Option is a functional option for OCIFileImage operations.

type UpdateOpt added in v0.11.0

type UpdateOpt func(*updateOpts) error

UpdateOpt are used to specify options to apply when updating a SIF.

func OptUpdateTempDir added in v0.11.0

func OptUpdateTempDir(d string) UpdateOpt

OptUpdateTempDir sets the directory to use for temporary files. If not set, the directory returned by os.TempDir is used.

type WriteOpt added in v0.9.0

type WriteOpt func(*writeOpts) error

WriteOpt are used to specify write options.

func OptWriteWithSpareDescriptorCapacity added in v0.9.0

func OptWriteWithSpareDescriptorCapacity(n int64) WriteOpt

OptWriteWithSpareDescriptorCapacity specifies that the SIF should be created with n spare descriptors.

Jump to

Keyboard shortcuts

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