Documentation ¶
Overview ¶
Package docker serves a remote suitable for use with docker volume api
Index ¶
- Variables
- type CapabilitiesResponse
- type Capability
- type CreateRequest
- type Driver
- func (drv *Driver) Create(req *CreateRequest) error
- func (drv *Driver) Exit()
- func (drv *Driver) Get(req *GetRequest) (*GetResponse, error)
- func (drv *Driver) List() (*ListResponse, error)
- func (drv *Driver) Mount(req *MountRequest) (*MountResponse, error)
- func (drv *Driver) Path(req *PathRequest) (*PathResponse, error)
- func (drv *Driver) Remove(req *RemoveRequest) error
- func (drv *Driver) Unmount(req *UnmountRequest) error
- type ErrorResponse
- type GetRequest
- type GetResponse
- type ListResponse
- type MountRequest
- type MountResponse
- type PathRequest
- type PathResponse
- type RemoveRequest
- type Server
- type UnmountRequest
- type VolInfo
- type VolOpts
- type Volume
Constants ¶
This section is empty.
Variables ¶
var ( ErrVolumeNotFound = errors.New("volume not found") ErrVolumeExists = errors.New("volume already exists") ErrMountpointExists = errors.New("non-empty mountpoint already exists") )
Errors
var Command = &cobra.Command{ Use: "docker", Short: `Serve any remote on docker's volume plugin API.`, Long: strings.ReplaceAll(longHelp, "|", "`") + vfs.Help, Run: func(command *cobra.Command, args []string) { cmd.CheckArgs(0, 0, command, args) cmd.Run(false, false, command, func() error { ctx := context.Background() drv, err := NewDriver(ctx, baseDir, nil, nil, false, forgetState) if err != nil { return err } srv := NewServer(drv) if socketAddr == "" { return srv.ServeUnix(pluginName, socketGid) } if filepath.IsAbs(socketAddr) { return srv.ServeUnix(socketAddr, socketGid) } return srv.ServeTCP(socketAddr, "", nil, noSpec) }) }, }
Command definition for cobra
Functions ¶
This section is empty.
Types ¶
type CapabilitiesResponse ¶
type CapabilitiesResponse struct {
Capabilities Capability
}
CapabilitiesResponse structure for a volume capability response
type Capability ¶
type Capability struct {
Scope string
}
Capability represents the list of capabilities a volume driver can return
type CreateRequest ¶
CreateRequest is the structure that docker's requests are deserialized to.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements docker driver api
func NewDriver ¶
func NewDriver(ctx context.Context, root string, mntOpt *mountlib.Options, vfsOpt *vfscommon.Options, dummy, forgetState bool) (*Driver, error)
NewDriver makes a new docker driver
func (*Driver) Create ¶
func (drv *Driver) Create(req *CreateRequest) error
Create volume To use subpath we are limited to defining a new volume definition via alias
func (*Driver) List ¶
func (drv *Driver) List() (*ListResponse, error)
List volumes handled by the driver
func (*Driver) Mount ¶
func (drv *Driver) Mount(req *MountRequest) (*MountResponse, error)
Mount volume
func (*Driver) Path ¶
func (drv *Driver) Path(req *PathRequest) (*PathResponse, error)
Path returns path of the requested volume
type ErrorResponse ¶
type ErrorResponse struct {
Err string
}
ErrorResponse is a formatted error message that docker can understand
type GetRequest ¶
type GetRequest struct {
Name string
}
GetRequest structure for a volume get request
type GetResponse ¶
type GetResponse struct {
Volume *VolInfo
}
GetResponse structure for a volume get response
type ListResponse ¶
type ListResponse struct {
Volumes []*VolInfo
}
ListResponse structure for a volume list response
type MountRequest ¶
MountRequest structure for a volume mount request
type MountResponse ¶
type MountResponse struct {
Mountpoint string
}
MountResponse structure for a volume mount response
type PathRequest ¶
type PathRequest struct {
Name string
}
PathRequest structure for a volume path request
type PathResponse ¶
type PathResponse struct {
Mountpoint string
}
PathResponse structure for a volume path response
type RemoveRequest ¶
type RemoveRequest struct {
Name string
}
RemoveRequest structure for a volume remove request
type Server ¶
Server connects plugin with docker daemon by protocol
func (*Server) ServeTCP ¶
ServeTCP makes the handler listen for request on a given TCP address. It also writes the spec file in the right directory for docker to read.
type UnmountRequest ¶
UnmountRequest structure for a volume unmount request
type VolInfo ¶
type VolInfo struct { Name string Mountpoint string `json:",omitempty"` CreatedAt string `json:",omitempty"` Status map[string]interface{} `json:",omitempty"` }
VolInfo represents a volume for Get and List requests
type Volume ¶
type Volume struct { Name string `json:"name"` MountPoint string `json:"mountpoint"` CreatedAt time.Time `json:"created"` Fs string `json:"fs"` // remote[,connectString]:path Type string `json:"type,omitempty"` // same as ":backend:" Path string `json:"path,omitempty"` // for "remote:path" or ":backend:path" Options VolOpts `json:"options"` // all options together Mounts []string `json:"mounts"` // mountReqs as a string list // contains filtered or unexported fields }
Volume keeps volume runtime state Public members get persisted in saved state