overlay

package
v20.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrApplyDiffFallback is returned to indicate that a normal ApplyDiff is applied as a fallback from Naive diff writer.
	ErrApplyDiffFallback = fmt.Errorf("Fall back to normal ApplyDiff")
)

Functions

func Init

func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error)

Init returns the NaiveDiffDriver, a native diff driver for overlay filesystem. If overlay filesystem is not supported on the host, the error graphdriver.ErrNotSupported is returned. If an overlay filesystem is not supported over an existing filesystem then error graphdriver.ErrIncompatibleFS is returned.

func NaiveDiffDriverWithApply

func NaiveDiffDriverWithApply(driver ApplyDiffProtoDriver, uidMaps, gidMaps []idtools.IDMap) graphdriver.Driver

NaiveDiffDriverWithApply returns a NaiveDiff driver with custom ApplyDiff.

Types

type ApplyDiffProtoDriver

type ApplyDiffProtoDriver interface {
	graphdriver.ProtoDriver
	// ApplyDiff writes the diff to the archive for the given id and parent id.
	// It returns the size in bytes written if successful, an error ErrApplyDiffFallback is returned otherwise.
	ApplyDiff(id, parent string, diff io.Reader) (size int64, err error)
}

ApplyDiffProtoDriver wraps the ProtoDriver by extending the interface with ApplyDiff method.

type Driver

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

Driver contains information about the home directory and the list of active mounts that are created using this driver.

func (*Driver) ApplyDiff

func (d *Driver) ApplyDiff(id string, parent string, diff io.Reader) (size int64, err error)

ApplyDiff applies the new layer on top of the root, if parent does not exist with will return an ErrApplyDiffFallback error.

func (*Driver) Cleanup

func (d *Driver) Cleanup() error

Cleanup any state created by overlay which should be cleaned when daemon is being shutdown. For now, we just have to unmount the bind mounted we had created.

func (*Driver) Create

func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) (retErr error)

Create is used to create the upper, lower, and merge directories required for overlay fs for a given id. The parent filesystem is used to configure these directories for the overlay.

func (*Driver) CreateReadWrite added in v1.12.0

func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error

CreateReadWrite creates a layer that is writable for use as a container file system.

func (*Driver) Exists

func (d *Driver) Exists(id string) bool

Exists checks to see if the id is already mounted.

func (*Driver) Get

func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, err error)

Get creates and mounts the required file system for the given id and returns the mount path.

func (*Driver) GetMetadata added in v1.8.0

func (d *Driver) GetMetadata(id string) (map[string]string, error)

GetMetadata returns metadata about the overlay driver such as root, LowerDir, UpperDir, WorkDir and MergeDir used to store data.

func (*Driver) Put

func (d *Driver) Put(id string) error

Put unmounts the mount path created for the give id. It also removes the 'merged' directory to force the kernel to unmount the overlay mount in other namespaces.

func (*Driver) Remove

func (d *Driver) Remove(id string) error

Remove cleans the directories that are created for this id.

func (*Driver) Status

func (d *Driver) Status() [][2]string

Status returns current driver information in a two dimensional string array. Output contains "Backing Filesystem" used in this implementation.

func (*Driver) String

func (d *Driver) String() string

Jump to

Keyboard shortcuts

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