Back to godoc.org
github.com/opencontainers/umoci

package umoci

v0.4.6
Latest Go to latest
Published: Jun 24, 2020 | License: Apache-2.0 | Module: github.com/opencontainers/umoci

Index

Constants

const MetaName = "umoci.json"

MetaName is the name of umoci's metadata file that is stored in all bundles extracted by umoci.

const MetaVersion = "2"

MetaVersion is the version of Meta supported by this code. The value is only bumped for updates which are not backwards compatible.

Variables

var MtreeKeywords = []mtree.Keyword{
	"size",
	"type",
	"uid",
	"gid",
	"mode",
	"link",
	"nlink",
	"tar_time",
	"sha256digest",
	"xattr",
}

MtreeKeywords is the set of keywords used by umoci for verification and diff generation of a bundle. This is based on mtree.DefaultKeywords, but is hardcoded here to ensure that vendor changes don't mess things up.

func CreateLayout

func CreateLayout(imagePath string) (casext.Engine, error)

CreateLayout creates an existing OCI image layout, and fails if it already exists.

func GenerateBundleManifest

func GenerateBundleManifest(mtreeName string, bundlePath string, fsEval mtree.FsEval) error

GenerateBundleManifest creates and writes an mtree of the rootfs in the given bundle path, using the supplied fsEval method

func NewImage

func NewImage(engineExt casext.Engine, tagName string) error

NewImage creates a new empty image (tag) in the existing layout.

func OpenLayout

func OpenLayout(imagePath string) (casext.Engine, error)

OpenLayout opens an existing OCI image layout, and fails if it does not exist.

func ParseIdmapOptions

func ParseIdmapOptions(meta *Meta, ctx *cli.Context) error

ParseIdmapOptions sets up the mapping options for Meta, using the arguments specified on the command line

func Repack

func Repack(engineExt casext.Engine, tagName string, bundlePath string, meta Meta, history *ispec.History, filters []mtreefilter.FilterFunc, refreshBundle bool, mutator *mutate.Mutator) error

Repack repacks a bundle into an image adding a new layer for the changed data in the bundle.

func Unpack

func Unpack(engineExt casext.Engine, fromName string, bundlePath string, mapOptions layer.MapOptions, callback layer.AfterLayerUnpackCallback, startFrom ispec.Descriptor) error

Unpack unpacks an image to the specified bundle path.

func WriteBundleMeta

func WriteBundleMeta(bundle string, meta Meta) error

WriteBundleMeta writes an umoci.json file to the given bundle path.

type ManifestStat

type ManifestStat struct {

	// History stores the history information for the manifest.
	History []historyStat `json:"history"`
}

ManifestStat has information about a given OCI manifest. TODO: Implement support for manifest lists, this should also be able to

contain stat information for a list of manifests.

func Stat

func Stat(ctx context.Context, engine casext.Engine, manifestDescriptor ispec.Descriptor) (ManifestStat, error)

Stat computes the ManifestStat for a given manifest blob. The provided descriptor must refer to an OCI Manifest.

func (ManifestStat) Format

func (ms ManifestStat) Format(w io.Writer) error

Format formats a ManifestStat using the default formatting, and writes the result to the given writer. TODO: This should really be implemented in a way that allows for users to

define their own custom templates for different blocks (meaning that
this should use text/template rather than using tabwriters manually.

type Meta

type Meta struct {
	// Version is the version of umoci used to unpack the bundle. This is used
	// to future-proof the umoci.json information.
	Version string `json:"umoci_version"`

	// From is a copy of the descriptor pointing to the image manifest that was
	// used to unpack the bundle. Essentially it's a resolved form of the
	// --image argument to umoci-unpack(1).
	From casext.DescriptorPath `json:"from_descriptor_path"`

	// MapOptions is the parsed version of --uid-map, --gid-map and --rootless
	// arguments to umoci-unpack(1). While all of these options technically do
	// not need to be the same for corresponding umoci-unpack(1) and
	// umoci-repack(1) calls, changing them is not recommended and so the
	// default should be that they are the same.
	MapOptions layer.MapOptions `json:"map_options"`
}

Meta represents metadata about how umoci unpacked an image to a bundle and other similar information. It is used to keep track of information that is required when repacking an image and other similar bundle information.

func ReadBundleMeta

func ReadBundleMeta(bundle string) (Meta, error)

ReadBundleMeta reads and parses the umoci.json file from a given bundle path.

func (Meta) WriteTo

func (m Meta) WriteTo(w io.Writer) (int64, error)

WriteTo writes a JSON-serialised version of Meta to the given io.Writer.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier