volume

package
v0.0.0-...-2bce64a Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

README

Docker volume extension api.

Go handler to create external volume extensions for Docker.

Usage

This library is designed to be integrated in your program.

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

Full example plugins

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Create(Request) Response
	List(Request) Response
	Get(Request) Response
	Remove(Request) Response
	Path(Request) Response
	Mount(Request) Response
	Unmount(Request) Response
}

Driver represent the interface a driver must fulfill.

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 Request

type Request struct {
	Name    string
	Options map[string]string `json:"Opts,omitempty"`
}

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

type Response

type Response struct {
	Mountpoint string
	Err        string
	Volumes    []*Volume
	Volume     *Volume
}

Response is the strucutre that the plugin's responses are serialized to.

type Volume

type Volume struct {
	Name       string
	Mountpoint string
}

Volume represents a volume object for use with `Get` and `List` requests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳