graphdriver

package
v0.0.0-...-8af45ff Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 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
	Err  string
}

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

func CallApplyDiff

func CallApplyDiff(url string, client *http.Client, req ApplyDiffRequest) (*ApplyDiffResponse, error)

CallApplyDiff is the raw call to the Graphdriver.ApplyDiff method

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
	Err     string
}

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

func CallChanges

func CallChanges(url string, client *http.Client, req ChangesRequest) (*ChangesResponse, error)

CallChanges is the raw call to the Graphdriver.Changes method

type CleanupRequest

type CleanupRequest struct{}

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

type CleanupResponse

type CleanupResponse struct {
	Err string
}

CleanupResponse is the structure that docker's cleanup responses are serialized to.

func CallCleanup

func CallCleanup(url string, client *http.Client, req CleanupRequest) (*CleanupResponse, error)

CallCleanup is the raw call to the Graphdriver.Cleanup method

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 CreateResponse

type CreateResponse struct {
	Err string
}

CreateResponse is the strucutre that docker's create responses are serialized to.

func CallCreate

func CallCreate(url string, client *http.Client, req CreateRequest) (*CreateResponse, error)

CallCreate is the raw call to the Graphdriver.Create method

func CallCreateReadWrite

func CallCreateReadWrite(url string, client *http.Client, req CreateRequest) (*CreateResponse, error)

CallCreateReadWrite is the raw call to the Graphdriver.CreateReadWrite method

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.

func CallDiff

func CallDiff(url string, client *http.Client, req DiffRequest) (*DiffResponse, error)

CallDiff is the raw call to the Graphdriver.Diff method

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
	Err  string
}

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

func CallDiffSize

func CallDiffSize(url string, client *http.Client, req DiffSizeRequest) (*DiffSizeResponse, error)

CallDiffSize is the raw call to the Graphdriver.CallDiffSize method

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) (string, 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)
}

Driver represent the interface a driver must fulfill.

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.

func CallExists

func CallExists(url string, client *http.Client, req ExistsRequest) (*ExistsResponse, error)

CallExists is the raw call to the Graphdriver.Exists method

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
	Err      string
}

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

func CallGetMetadata

func CallGetMetadata(url string, client *http.Client, req GetMetadataRequest) (*GetMetadataResponse, error)

CallGetMetadata is the raw call to the Graphdriver.GetMetadata method

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
	Err string
}

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

func CallGet

func CallGet(url string, client *http.Client, req GetRequest) (*GetResponse, error)

CallGet is the raw call to the Graphdriver.Get method

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 InitResponse

type InitResponse struct {
	Err string
}

InitResponse is the strucutre that docker's init responses are serialized to.

func CallInit

func CallInit(url string, client *http.Client, req InitRequest) (*InitResponse, error)

CallInit is the raw call to the Graphdriver.Init method

type PutRequest

type PutRequest struct {
	ID string
}

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

type PutResponse

type PutResponse struct {
	Err string
}

PutResponse is the strucutre that docker's put responses are serialized to.

func CallPut

func CallPut(url string, client *http.Client, req PutRequest) (*PutResponse, error)

CallPut is the raw call to the Graphdriver.Put method

type RemoveRequest

type RemoveRequest struct {
	ID string
}

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

type RemoveResponse

type RemoveResponse struct {
	Err string
}

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

func CallRemove

func CallRemove(url string, client *http.Client, req RemoveRequest) (*RemoveResponse, error)

CallRemove is the raw call to the Graphdriver.Remove method

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.

func CallStatus

func CallStatus(url string, client *http.Client, req StatusRequest) (*StatusResponse, error)

CallStatus is the raw call to the Graphdriver.Status method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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