graphdriver

package
v1.3.1-0...-d453d8b Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FsMagicBtrfs = FsMagic(0x9123683E)
	FsMagicAufs  = FsMagic(0x61756673)
)

Variables

View Source
var (
	DefaultDriver string

	ErrNotSupported   = errors.New("driver not supported")
	ErrPrerequisites  = errors.New("prerequisites for driver not satisfied (wrong filesystem?)")
	ErrIncompatibleFS = fmt.Errorf("backing file system is unsupported for this graph driver")
)

Functions

func Register

func Register(name string, initFunc InitFunc) error

Types

type Driver

type Driver interface {
	ProtoDriver
	// Diff produces an archive of the changes between the specified
	// layer and its parent layer which may be "".
	Diff(id, parent string) (archive.Archive, error)
	// Changes produces a list of changes between the specified layer
	// and its parent layer. If parent is "", then all changes will be ADD changes.
	Changes(id, parent string) ([]archive.Change, error)
	// ApplyDiff extracts the changeset from the given diff into the
	// layer with the specified id and parent, returning the size of the
	// new layer in bytes.
	ApplyDiff(id, parent string, diff archive.ArchiveReader) (bytes int64, err error)
	// DiffSize calculates the changes between the specified id
	// and its parent and returns the size in bytes of the changes
	// relative to its base filesystem directory.
	DiffSize(id, parent string) (bytes int64, err error)
}

Driver is the interface for layered/snapshot file system drivers.

func GetDriver

func GetDriver(name, home string, options []string) (Driver, error)

func NaiveDiffDriver

func NaiveDiffDriver(driver ProtoDriver) Driver

NaiveDiffDriver returns a fully functional driver that wraps the given ProtoDriver and adds the capability of the following methods which it may or may not support on its own:

Diff(id, parent string) (archive.Archive, error)
Changes(id, parent string) ([]archive.Change, error)
ApplyDiff(id, parent string, diff archive.ArchiveReader) (bytes int64, err error)
DiffSize(id, parent string) (bytes int64, err error)

func New

func New(root string, options []string) (driver Driver, err error)

type FsMagic

type FsMagic uint64

type InitFunc

type InitFunc func(root string, options []string) (Driver, error)

type ProtoDriver

type ProtoDriver interface {
	// String returns a string representation of this driver.
	String() string
	// Create creates a new, empty, filesystem layer with the
	// specified id and parent. Parent may be "".
	Create(id, parent string) error
	// Remove attempts to remove the filesystem layer with this id.
	Remove(id string) error
	// Get returns the mountpoint for the layered filesystem referred
	// to by this id. You can optionally specify a mountLabel or "".
	// Returns the absolute path to the mounted layered filesystem.
	Get(id, mountLabel string) (dir string, err error)
	// Put releases the system resources for the specified id,
	// e.g, unmounting layered filesystem.
	Put(id string)
	// Exists returns whether a filesystem layer with the specified
	// ID exists on this driver.
	Exists(id string) bool
	// Status returns a set of key-value pairs which give low
	// level diagnostic status about this driver.
	Status() [][2]string
	// Cleanup performs necessary tasks to release resources
	// held by the driver, e.g., unmounting all layered filesystems
	// known to this driver.
	Cleanup() error
}

ProtoDriver defines the basic capabilities of a driver. This interface exists solely to be a minimum set of methods for client code which choose not to implement the entire Driver interface and use the NaiveDiffDriver wrapper constructor.

Use of ProtoDriver directly by client code is not recommended.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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