types

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrContainerUnknown indicates that there was no container with the specified name or ID.
	ErrContainerUnknown = errors.New("container not known")
	// ErrDigestUnknown indicates that we were unable to compute the digest of a specified item.
	ErrDigestUnknown = errors.New("could not compute digest of item")
	// ErrDuplicateID indicates that an ID which is to be assigned to a new item is already being used.
	ErrDuplicateID = errors.New("that ID is already in use")
	// ErrDuplicateImageNames indicates that the read-only store uses the same name for multiple images.
	ErrDuplicateImageNames = errors.New("read-only image store assigns the same name to multiple images")
	// ErrDuplicateLayerNames indicates that the read-only store uses the same name for multiple layers.
	ErrDuplicateLayerNames = errors.New("read-only layer store assigns the same name to multiple layers")
	// ErrDuplicateName indicates that a name which is to be assigned to a new item is already being used.
	ErrDuplicateName = errors.New("that name is already in use")
	// ErrImageUnknown indicates that there was no image with the specified name or ID.
	ErrImageUnknown = errors.New("image not known")
	// ErrImageUsedByContainer is returned when the caller attempts to delete an image that is a container's image.
	ErrImageUsedByContainer = errors.New("image is in use by a container")
	// ErrIncompleteOptions is returned when the caller attempts to initialize a Store without providing required information.
	ErrIncompleteOptions = errors.New("missing necessary StoreOptions")
	// ErrInvalidBigDataName indicates that the name for a big data item is not acceptable; it may be empty.
	ErrInvalidBigDataName = errors.New("not a valid name for a big data item")
	// ErrLayerHasChildren is returned when the caller attempts to delete a layer that has children.
	ErrLayerHasChildren = errors.New("layer has children")
	// ErrLayerNotMounted is returned when the requested information can only be computed for a mounted layer, and the layer is not mounted.
	ErrLayerNotMounted = errors.New("layer is not mounted")
	// ErrLayerUnknown indicates that there was no layer with the specified name or ID.
	ErrLayerUnknown = errors.New("layer not known")
	// ErrLayerUsedByContainer is returned when the caller attempts to delete a layer that is a container's layer.
	ErrLayerUsedByContainer = errors.New("layer is in use by a container")
	// ErrLayerUsedByImage is returned when the caller attempts to delete a layer that is an image's top layer.
	ErrLayerUsedByImage = errors.New("layer is in use by an image")
	// ErrLoadError indicates that there was an initialization error.
	ErrLoadError = errors.New("error loading storage metadata")
	// ErrNotAContainer is returned when the caller attempts to delete a container that isn't a container.
	ErrNotAContainer = errors.New("identifier is not a container")
	// ErrNotALayer is returned when the caller attempts to delete a layer that isn't a layer.
	ErrNotALayer = errors.New("identifier is not a layer")
	// ErrNotAnID is returned when the caller attempts to read or write metadata from an item that doesn't exist.
	ErrNotAnID = errors.New("identifier is not a layer, image, or container")
	// ErrNotAnImage is returned when the caller attempts to delete an image that isn't an image.
	ErrNotAnImage = errors.New("identifier is not an image")
	// ErrParentIsContainer is returned when a caller attempts to create a layer as a child of a container's layer.
	ErrParentIsContainer = errors.New("would-be parent layer is a container")
	// ErrParentUnknown indicates that we didn't record the ID of the parent of the specified layer.
	ErrParentUnknown = errors.New("parent of layer not known")
	// ErrSizeUnknown is returned when the caller asks for the size of a big data item, but the Store couldn't determine the answer.
	ErrSizeUnknown = errors.New("size is not known")
	// ErrStoreIsReadOnly is returned when the caller makes a call to a read-only store that would require modifying its contents.
	ErrStoreIsReadOnly = errors.New("called a write method on a read-only store")
	// ErrNotSupported is returned when the requested functionality is not supported.
	ErrNotSupported = errors.New("not supported")
	// ErrInvalidMappings is returned when the specified mappings are invalid.
	ErrInvalidMappings = errors.New("invalid mappings specified")
	// ErrNoAvailableIDs is returned when there are not enough unused IDS within the user namespace.
	ErrNoAvailableIDs = errors.New("not enough unused IDs in user namespace")

	// ErrLayerUnaccounted describes a layer that is present in the lower-level storage driver,
	// but which is not known to or managed by the higher-level driver-agnostic logic.
	ErrLayerUnaccounted = errors.New("layer in lower level storage driver not accounted for")
	// ErrLayerUnreferenced describes a layer which is not used by any image or container.
	ErrLayerUnreferenced = errors.New("layer not referenced by any images or containers")
	// ErrLayerIncorrectContentDigest describes a layer for which the contents of one or more
	// files which were added in the layer appear to have changed.  It may instead look like an
	// unnamed "file integrity checksum failed" error.
	ErrLayerIncorrectContentDigest = errors.New("layer content incorrect digest")
	// ErrLayerIncorrectContentSize describes a layer for which regenerating the diff that was
	// used to populate the layer produced a diff of a different size.  We check the digest
	// first, so it's highly unlikely you'll ever see this error.
	ErrLayerIncorrectContentSize = errors.New("layer content incorrect size")
	// ErrLayerContentModified describes a layer which contains contents which should not be
	// there, or for which ownership/permissions/dates have been changed.
	ErrLayerContentModified = errors.New("layer content modified")
	// ErrLayerDataMissing describes a layer which is missing a big data item.
	ErrLayerDataMissing = errors.New("layer data item is missing")
	// ErrLayerMissing describes a layer which is the missing parent of a layer.
	ErrLayerMissing = errors.New("layer is missing")
	// ErrImageLayerMissing describes an image which claims to have a layer that we don't know
	// about.
	ErrImageLayerMissing = errors.New("image layer is missing")
	// ErrImageDataMissing describes an image which is missing a big data item.
	ErrImageDataMissing = errors.New("image data item is missing")
	// ErrImageDataIncorrectSize describes an image which has a big data item which looks like
	// its size has changed, likely because it's been modified somehow.
	ErrImageDataIncorrectSize = errors.New("image data item has incorrect size")
	// ErrContainerImageMissing describes a container which claims to be based on an image that
	// we don't know about.
	ErrContainerImageMissing = errors.New("image missing")
	// ErrContainerDataMissing describes a container which is missing a big data item.
	ErrContainerDataMissing = errors.New("container data item is missing")
	// ErrContainerDataIncorrectSize describes a container which has a big data item which looks
	// like its size has changed, likely because it's been modified somehow.
	ErrContainerDataIncorrectSize = errors.New("container data item has incorrect size")
)

Functions

This section is empty.

Types

type AutoUserNsOptions

type AutoUserNsOptions struct {
	// Size defines the size for the user namespace.  If it is set to a
	// value bigger than 0, the user namespace will have exactly this size.
	// If it is not set, some heuristics will be used to find its size.
	Size uint32
	// InitialSize defines the minimum size for the user namespace.
	// The created user namespace will have at least this size.
	InitialSize uint32
	// PasswdFile to use if the container uses a volume.
	PasswdFile string
	// GroupFile to use if the container uses a volume.
	GroupFile string
	// AdditionalUIDMappings specified additional UID mappings to include in
	// the generated user namespace.
	AdditionalUIDMappings []idtools.IDMap
	// AdditionalGIDMappings specified additional GID mappings to include in
	// the generated user namespace.
	AdditionalGIDMappings []idtools.IDMap
}

AutoUserNsOptions defines how to automatically create a user namespace.

type IDMappingOptions

type IDMappingOptions struct {
	// HostUIDMapping indicates that no UID mapping should be applied.
	// When true, UIDMap is ignored and files are accessed with host UIDs.
	HostUIDMapping bool
	// HostGIDMapping indicates that no GID mapping should be applied.
	// When true, GIDMap is ignored and files are accessed with host GIDs.
	HostGIDMapping bool
	// UIDMap defines the UID mappings for the user namespace.
	// Only used when HostUIDMapping is false.
	UIDMap []idtools.IDMap
	// GIDMap defines the GID mappings for the user namespace.
	// Only used when HostGIDMapping is false.
	GIDMap         []idtools.IDMap
	AutoUserNs     bool
	AutoUserNsOpts AutoUserNsOptions
}

IDMappingOptions specifies the caller's desired UID/GID mapping for a layer or container.

These options express what the caller wants, the mapping that the container's user namespace should use. They do not describe what is stored on disk. Depending on the graph driver, the store may apply the mapping at layer creation time (by chowning files) or defer it to mount time (using idmapped mounts or fuse-overlayfs options), but that distinction is transparent to the caller.

The resolution order for the effective UID/GID maps is:

  1. If HostUIDMapping/HostGIDMapping is true, no mapping is used (the corresponding UIDMap/GIDMap is ignored and treated as empty).
  2. If UIDMap/GIDMap contain at least one entry, those mappings are used.
  3. Otherwise, if the layer has a parent, the parent's mappings are inherited.
  4. Otherwise, the Store-level default mappings are used.

func ParseIDMapping

func ParseIDMapping(UIDMapSlice, GIDMapSlice []string, subUIDMap, subGIDMap string) (*IDMappingOptions, error)

ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping

type LoadOptions added in v1.63.0

type LoadOptions struct {
	// RootForImplicitAbsolutePaths is the path to an alternate root
	// If not "", prefixed to any absolute paths used by default in the package.
	// NOTE: This does NOT affect paths starting by $HOME or environment variables paths.
	RootForImplicitAbsolutePaths string
}

type StoreOptions

type StoreOptions struct {
	// RunRoot is the filesystem path under which we can store run-time
	// information, such as the locations of active mount points, that we
	// want to lose if the host is rebooted.
	RunRoot string `json:"runroot,omitempty"`
	// GraphRoot is the filesystem path under which we will store the
	// contents of layers, images, and containers.
	GraphRoot string `json:"root,omitempty"`
	// Image Store is the alternate location of image store if a location
	// separate from the container store is required.
	ImageStore string `json:"imagestore,omitempty"`
	// If the driver is not specified, the best suited driver will be picked
	// either from GraphDriverPriority, if specified, or from the platform
	// dependent priority list (in that order).
	GraphDriverName string `json:"driver,omitempty"`
	// GraphDriverPriority is a list of storage drivers that will be tried
	// to initialize the Store for a given RunRoot and GraphRoot unless a
	// GraphDriverName is set.
	// This list can be used to define a custom order in which the drivers
	// will be tried.
	GraphDriverPriority []string `json:"driver-priority,omitempty"`
	// GraphDriverOptions are driver-specific options.
	GraphDriverOptions []string `json:"driver-options,omitempty"`
	// UIDMap and GIDMap are used for setting up a container's root filesystem
	// for use inside of a user namespace where UID mapping is being used.
	UIDMap []idtools.IDMap `json:"uidmap,omitempty"`
	GIDMap []idtools.IDMap `json:"gidmap,omitempty"`
	// RootAutoNsUser is the user used to pick a subrange when automatically setting
	// a user namespace for the root user.
	RootAutoNsUser string `json:"root_auto_ns_user,omitempty"`
	// AutoNsMinSize is the minimum size for an automatic user namespace.
	AutoNsMinSize uint32 `json:"auto_userns_min_size,omitempty"`
	// AutoNsMaxSize is the maximum size for an automatic user namespace.
	AutoNsMaxSize uint32 `json:"auto_userns_max_size,omitempty"`
	// PullOptions specifies options to be handed to pull managers
	// This API is experimental and can be changed without bumping the major version number.
	PullOptions map[string]string `toml:"pull_options"`
	// DisableVolatile doesn't allow volatile mounts when it is set.
	DisableVolatile bool `json:"disable-volatile,omitempty"`
	// If transient, don't persist containers over boot (stores db in runroot)
	TransientStore bool `json:"transient_store,omitempty"`
}

StoreOptions is used for passing initialization options to GetStore(), for initializing a Store object and the underlying storage that it controls.

func DefaultStoreOptions

func DefaultStoreOptions() (StoreOptions, error)

DefaultStoreOptions is returning the default StoreOptions parsed with the storage.conf files. This function caches the result so multiple callers always will get the same result. In order to parse storage.conf files at a later point use LoadStoreOptions.

func LoadStoreOptions added in v1.63.0

func LoadStoreOptions(opts LoadOptions) (StoreOptions, error)

LoadStoreOptions is returning the default StoreOptions parsed with the storage.conf files. LoadOptions can be used to supply an alternative root for the storage.conf files. On each call all files will be parsed again, to only get the correct system defaults and have them cached consider using DefaultStoreOptions instead.

type TomlConfig

type TomlConfig struct {
	Storage struct {
		Driver              string            `toml:"driver,omitempty"`
		DriverPriority      configfile.Slice  `toml:"driver_priority,omitempty"`
		RunRoot             string            `toml:"runroot,omitempty"`
		ImageStore          string            `toml:"imagestore,omitempty"`
		GraphRoot           string            `toml:"graphroot,omitempty"`
		RootlessStoragePath string            `toml:"rootless_storage_path,omitempty"`
		TransientStore      bool              `toml:"transient_store,omitempty"`
		Options             cfg.OptionsConfig `toml:"options,omitempty"`
	} `toml:"storage"`
}

TOML-friendly explicit tables used for conversions.

Jump to

Keyboard shortcuts

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