Documentation ¶
Overview ¶
Package layout provides facilities for reading/writing artifacts from/to an OCI image layout on disk, see:
https://github.com/opencontainers/image-spec/blob/master/image-layout.md
Index ¶
- func ImageIndexFromPath(path string) (v1.ImageIndex, error)
- type Option
- type Path
- func (l Path) AppendDescriptor(desc v1.Descriptor) error
- func (l Path) AppendImage(img v1.Image, options ...Option) error
- func (l Path) AppendIndex(ii v1.ImageIndex, options ...Option) error
- func (l Path) Blob(h v1.Hash) (io.ReadCloser, error)
- func (l Path) Bytes(h v1.Hash) ([]byte, error)
- func (l Path) Image(h v1.Hash) (v1.Image, error)
- func (l Path) ImageIndex() (v1.ImageIndex, error)
- func (l Path) WriteBlob(hash v1.Hash, r io.ReadCloser) error
- func (l Path) WriteFile(name string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImageIndexFromPath ¶
func ImageIndexFromPath(path string) (v1.ImageIndex, error)
ImageIndexFromPath is a convenience function which constructs a Path and returns its v1.ImageIndex.
Types ¶
type Option ¶
type Option func(*v1.Descriptor) error
Option is a functional option for Layout.
TODO: We'll need to change this signature to support Sparse/Thin images. Or, alternatively, wrap it in a sparse.Image that returns an empty list for layers?
func WithAnnotations ¶
WithAnnotations adds annotations to the artifact descriptor.
func WithPlatform ¶
WithPlatform sets the platform of the artifact descriptor.
type Path ¶
type Path string
Path represents an OCI image layout rooted in a file system path
func Write ¶
func Write(path string, ii v1.ImageIndex) (Path, error)
Write constructs a Path at path from an ImageIndex.
The contents are written in the following format: At the top level, there is:
One oci-layout file containing the version of this image-layout. One index.json file listing descriptors for the contained images.
Under blobs/, there is, for each image:
One file for each layer, named after the layer's SHA. One file for each config blob, named after its SHA. One file for each manifest blob, named after its SHA.
func (Path) AppendDescriptor ¶
func (l Path) AppendDescriptor(desc v1.Descriptor) error
AppendDescriptor adds a descriptor to the index.json of the Path.
func (Path) AppendImage ¶
AppendImage writes a v1.Image to the Path and updates the index.json to reference it.
func (Path) AppendIndex ¶
func (l Path) AppendIndex(ii v1.ImageIndex, options ...Option) error
AppendIndex writes a v1.ImageIndex to the Path and updates the index.json to reference it.
func (Path) ImageIndex ¶
func (l Path) ImageIndex() (v1.ImageIndex, error)
ImageIndex returns a v1.ImageIndex for the Path.
func (Path) WriteBlob ¶
WriteBlob copies a file to the blobs/ directory in the Path from the given ReadCloser at blobs/{hash.Algorithm}/{hash.Hex}.