graphdriver

package
v0.0.0-...-6eecb7b Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

Docker volume extension api.

Go handler to create external graphdriver extensions for Docker.

Usage

This library is designed to be integrated in your program.

  1. Implement the graphdriver.Driver interface.
  2. Initialize a graphdriver.Handler with your implementation.
  3. Call either ServeTCP or ServeUnix from the graphdriver.Handler.
Example using TCP sockets:
  d := MyGraphDriver{}
  h := graphdriver.NewHandler(d)
  h.ServeTCP("test_graph", ":8080")
Example using Unix sockets:
  d := MyGraphDriver{}
  h := graphdriver.NewHandler(d)
  h.ServeUnix("root", "test_graph")

Documentation

Index

Constants

View Source
const (
	// DefaultDockerRootDirectory is the default directory where graph drivers will be created.
	DefaultDockerRootDirectory = "/var/lib/docker/graph"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyDiffRequest

type ApplyDiffRequest struct {
	Stream io.Reader // TAR STREAM
	ID     string
	Parent string
}

ApplyDiffRequest is the structure that docker's applyDiff requests are deserialized to.

type ApplyDiffResponse

type ApplyDiffResponse struct {
	Size int64
}

ApplyDiffResponse is the structure that docker's applyDiff responses are serialized to.

type CapabilitiesRequest

type CapabilitiesRequest struct{}

CapabilitiesRequest is the structure that docker's capabilities requests are deserialized to.

type CapabilitiesResponse

type CapabilitiesResponse struct {
	Capabilities graphDriver.Capabilities
}

CapabilitiesResponse is the structure that docker's capabilities responses are serialized to.

type Change

type Change struct {
	Path string
	Kind ChangeKind
}

Change is the structure that docker's individual changes are serialized to.

type ChangeKind

type ChangeKind int

ChangeKind represents the type of change mage

const (
	// Modified is a ChangeKind used when an item has been modified
	Modified ChangeKind = iota
	// Added is a ChangeKind used when an item has been added
	Added
	// Deleted is a ChangeKind used when an item has been deleted
	Deleted
)

type ChangesRequest

type ChangesRequest struct {
	ID     string
	Parent string
}

ChangesRequest is the structure that docker's changes requests are deserialized to.

type ChangesResponse

type ChangesResponse struct {
	Changes []Change
}

ChangesResponse is the structure that docker's changes responses are serialized to.

type CleanupRequest

type CleanupRequest struct{}

CleanupRequest is the structure that docker's cleanup requests are deserialized to.

type CreateRequest

type CreateRequest struct {
	ID         string
	Parent     string
	MountLabel string
	StorageOpt map[string]string
}

CreateRequest is the structure that docker's create requests are deserialized to.

type DiffRequest

type DiffRequest struct {
	ID     string
	Parent string
}

DiffRequest is the structure that docker's diff requests are deserialized to.

type DiffResponse

type DiffResponse struct {
	Stream io.ReadCloser // TAR STREAM
}

DiffResponse is the structure that docker's diff responses are serialized to.

type DiffSizeRequest

type DiffSizeRequest struct {
	ID     string
	Parent string
}

DiffSizeRequest is the structure that docker's diffSize requests are deserialized to.

type DiffSizeResponse

type DiffSizeResponse struct {
	Size int64
}

DiffSizeResponse is the structure that docker's diffSize responses are serialized to.

type Driver

type Driver interface {
	Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) error
	Create(id, parent, mountlabel string, storageOpt map[string]string) error
	CreateReadWrite(id, parent, mountlabel string, storageOpt map[string]string) error
	Remove(id string) error
	Get(id, mountLabel string) (containerfs.ContainerFS, error)
	Put(id string) error
	Exists(id string) bool
	Status() [][2]string
	GetMetadata(id string) (map[string]string, error)
	Cleanup() error
	Diff(id, parent string) io.ReadCloser
	Changes(id, parent string) ([]Change, error)
	ApplyDiff(id, parent string, archive io.Reader) (int64, error)
	DiffSize(id, parent string) (int64, error)
	Capabilities() graphDriver.Capabilities
}

Driver represent the interface a driver must fulfill.

type ErrorResponse

type ErrorResponse struct {
	Err string
}

ErrorResponse is a formatted error message that docker can understand

func NewErrorResponse

func NewErrorResponse(msg string) *ErrorResponse

NewErrorResponse creates an ErrorResponse with the provided message

type ExistsRequest

type ExistsRequest struct {
	ID string
}

ExistsRequest is the structure that docker's exists requests are deserialized to.

type ExistsResponse

type ExistsResponse struct {
	Exists bool
}

ExistsResponse is the structure that docker's exists responses are serialized to.

type GetMetadataRequest

type GetMetadataRequest struct {
	ID string
}

GetMetadataRequest is the structure that docker's getMetadata requests are deserialized to.

type GetMetadataResponse

type GetMetadataResponse struct {
	Metadata map[string]string
}

GetMetadataResponse is the structure that docker's getMetadata responses are serialized to.

type GetRequest

type GetRequest struct {
	ID         string
	MountLabel string
}

GetRequest is the structure that docker's get requests are deserialized to.

type GetResponse

type GetResponse struct {
	Dir string
}

GetResponse is the strucutre that docker's remove responses are serialized to.

type Handler

type Handler struct {
	sdk.Handler
	// contains filtered or unexported fields
}

Handler forwards requests and responses between the docker daemon and the plugin.

func NewHandler

func NewHandler(driver Driver) *Handler

NewHandler initializes the request handler with a driver implementation.

type InitRequest

type InitRequest struct {
	Home    string
	Options []string        `json:"Opts"`
	UIDMaps []idtools.IDMap `json:"UIDMaps"`
	GIDMaps []idtools.IDMap `json:"GIDMaps"`
}

InitRequest is the structure that docker's init requests are deserialized to.

type PutRequest

type PutRequest struct {
	ID string
}

PutRequest is the structure that docker's put requests are deserialized to.

type RemoveRequest

type RemoveRequest struct {
	ID string
}

RemoveRequest is the structure that docker's remove requests are deserialized to.

type StatusRequest

type StatusRequest struct{}

StatusRequest is the structure that docker's status requests are deserialized to.

type StatusResponse

type StatusResponse struct {
	Status [][2]string
}

StatusResponse is the structure that docker's status responses are serialized to.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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