basic

package
v0.0.0-...-afb0379 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 12 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	Lock         sync.RWMutex
	Persistence  *viper.Viper
	Volumes      map[string]*Volume
	Mounts       map[string]*Mountpoint
	Config       *DriverConfig
	EventHandler *DriverEventHandler
}

Driver the global driver responding to call

func Init

func Init(config *DriverConfig, eventHandler *DriverEventHandler) *Driver

Init load configuration and serve response to API call

func (*Driver) Capabilities

func (d *Driver) Capabilities() *volume.CapabilitiesResponse

Capabilities Send capabilities of the local driver

func (*Driver) Create

func (d *Driver) Create(r *volume.CreateRequest) error

Create create and init the requested volume

func (*Driver) Get

Get get info on the requested volume

func (*Driver) GetLock

func (d *Driver) GetLock() *sync.RWMutex

GetLock list lock of driver

func (*Driver) GetMounts

func (d *Driver) GetMounts() map[string]driver.Mount

GetMounts list mounts of driver

func (*Driver) GetVolumes

func (d *Driver) GetVolumes() map[string]driver.Volume

GetVolumes list volumes of driver

func (*Driver) List

func (d *Driver) List() (*volume.ListResponse, error)

List Volumes handled by these driver

func (*Driver) Mount

Mount mount the requested volume

func (*Driver) Path

Path get path of the requested volume

func (*Driver) Remove

func (d *Driver) Remove(r *volume.RemoveRequest) error

Remove remove the requested volume

func (*Driver) RemoveMount

func (d *Driver) RemoveMount(id string) error

RemoveMount remove a mount of driver

func (*Driver) RemoveVolume

func (d *Driver) RemoveVolume(id string) error

RemoveVolume remove a volume of driver

func (*Driver) RunCmd

func (d *Driver) RunCmd(cmd string) error

RunCmd run deamon in context of this gvfs drive with custome env

func (*Driver) SaveConfig

func (d *Driver) SaveConfig() error

SaveConfig stroe config/state in file

func (*Driver) Unmount

func (d *Driver) Unmount(r *volume.UnmountRequest) error

Unmount unmount the requested volume

type DriverConfig

type DriverConfig struct {
	Version       int
	Root          string
	Folder        string
	CustomOptions map[string]interface{}
}

DriverConfig contains configration of driver

type DriverEventHandler

type DriverEventHandler struct {
	OnInit        func(*Driver) error
	OnMountVolume func(*Driver, driver.Volume, driver.Mount, *volume.MountRequest) (*volume.MountResponse, error)
	GetMountName  func(d *Driver, r *volume.CreateRequest) (string, error)
}

DriverEventHandler contains function to execute on event

type Mountpoint

type Mountpoint struct {
	Path        string `json:"path"`
	Connections int    `json:"connections"`
}

Mountpoint represent a docker volume mountpoint

func (*Mountpoint) GetConnections

func (d *Mountpoint) GetConnections() int

GetConnections get number of connection on mount

func (*Mountpoint) GetPath

func (d *Mountpoint) GetPath() string

GetPath get path of mount

func (*Mountpoint) SetConnections

func (d *Mountpoint) SetConnections(n int)

SetConnections set number of connection on mount

type Persistence

type Persistence struct {
	Version int                    `json:"version"`
	Volumes map[string]*Volume     `json:"volumes"`
	Mounts  map[string]*Mountpoint `json:"mounts"`
}

Persistence represent struct of Persistence file

type Volume

type Volume struct {
	Options     map[string]string `json:"options"`
	Mount       string            `json:"mount"`
	Connections int               `json:"connections"`
}

Volume represent a docker volume

func (*Volume) GetConnections

func (v *Volume) GetConnections() int

GetConnections get number of connection on volume

func (*Volume) GetMount

func (v *Volume) GetMount() string

GetMount get mount of volume

func (*Volume) GetOptions

func (v *Volume) GetOptions() map[string]string

GetOptions get options definition of volume

func (*Volume) GetStatus

func (v *Volume) GetStatus() map[string]interface{}

func (*Volume) SetConnections

func (v *Volume) SetConnections(n int)

SetConnections set number of connection on volume

Jump to

Keyboard shortcuts

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