nix

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

This package can be used to generate image configuration and blobs from an image JSON file.

First, you need to create an types.Image with NewImageFromFile.

With this types.Image object, it is then possible to get the image configuration with the GetConfigBlob method. To get layer blobs, you need to iterate on the layers of the image and use the GetBlob or LayerGetBlob functions to get a Reader on this layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlob

func GetBlob(image types.Image, digest godigest.Digest) (io.ReadCloser, int64, error)

GetBlob gets the layer corresponding to the provided digest.

func GetConfigBlob

func GetConfigBlob(image types.Image) ([]byte, error)

GetConfigBlob returns the config blog of an image.

func GetConfigDigest

func GetConfigDigest(image types.Image) (d godigest.Digest, size int64, err error)

GetConfigDigest returns the digest and the size of the config blog of an image.

func LayerGetBlob

func LayerGetBlob(layer types.Layer) (reader io.ReadCloser, size int64, err error)

func NewImageFromDir

func NewImageFromDir(directory string) (image types.Image, err error)

NewImageFromDir builds an Image based on an directory populated by the Skopeo dir transport. The directory needs to be a absolute path since tarball filepaths are referenced in the image Layers.

func NewImageFromFile

func NewImageFromFile(filename string) (image types.Image, err error)

NewImageFromDir creates an Image from a JSON file describing an image. This file has usually been created by Nix through the nix2container binary.

func NewLayers

func NewLayers(storePaths []string, maxLayers int, parents []types.Layer, rewrites []types.RewritePath, exclude string, perms []types.PermPath) ([]types.Layer, error)

func NewLayersNonReproducible

func NewLayersNonReproducible(storePaths []string, maxLayers int, tarDirectory string, parents []types.Layer, rewrites []types.RewritePath, exclude string, perms []types.PermPath) (layers []types.Layer, err error)

func TarPaths

func TarPaths(paths types.Paths) io.ReadCloser

TarPaths takes a list of paths and return a ReadCloser to the tar archive. If an error occurs, the ReadCloser is closed with the error.

func TarPathsSum

func TarPathsSum(paths types.Paths) (digest.Digest, int64, error)

func TarPathsWrite

func TarPathsWrite(paths types.Paths, destinationDirectory string) (string, digest.Digest, int64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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