volume

package
v0.4.19 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BTFSDriverName             = "btfs"
	BTFSImage                  = "sonm/btfs@sha256:b64b4a7849aa742049b039aeabcaff0fa58876c00df9abdf0321d3fff31789a2"
	DefaultDockerRootDirectory = volume.DefaultDockerRootDirectory
)
View Source
const (
	OptionNetworkName = "NetworkName"
	OptionNetworkID   = "NetworkID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BTFSDockerDriver added in v0.4.8

type BTFSDockerDriver struct {
	// contains filtered or unexported fields
}

BTFSDockerDriver is a Docker driver implementation for BTFS volume plugin.

func NewBTFSDockerDriver added in v0.4.8

func NewBTFSDockerDriver(client *docker.Client, log *zap.SugaredLogger) (*BTFSDockerDriver, error)

func (*BTFSDockerDriver) Capabilities added in v0.4.8

func (m *BTFSDockerDriver) Capabilities() *volume.CapabilitiesResponse

func (*BTFSDockerDriver) Create added in v0.4.8

func (m *BTFSDockerDriver) Create(request *volume.CreateRequest) error

func (*BTFSDockerDriver) Get added in v0.4.8

func (*BTFSDockerDriver) List added in v0.4.8

func (m *BTFSDockerDriver) List() (*volume.ListResponse, error)

func (*BTFSDockerDriver) Mount added in v0.4.8

func (*BTFSDockerDriver) Path added in v0.4.8

func (*BTFSDockerDriver) Remove added in v0.4.8

func (m *BTFSDockerDriver) Remove(request *volume.RemoveRequest) error

func (*BTFSDockerDriver) Unmount added in v0.4.8

func (m *BTFSDockerDriver) Unmount(request *volume.UnmountRequest) error

type BTFSDockerVolume added in v0.4.8

type BTFSDockerVolume struct {
	Client      *docker.Client
	MagnetURI   string
	MountPoint  string
	ID          string
	Connections int
	NetworkName string
	NetworkID   string
}

type BTFSDriver added in v0.4.8

type BTFSDriver struct {
	// contains filtered or unexported fields
}

func NewBTFSDriver added in v0.4.8

func NewBTFSDriver(options ...Option) (*BTFSDriver, error)

func (*BTFSDriver) Close added in v0.4.8

func (m *BTFSDriver) Close() error

func (*BTFSDriver) CreateVolume added in v0.4.8

func (m *BTFSDriver) CreateVolume(name string, options map[string]string) (Volume, error)

func (*BTFSDriver) RemoveVolume added in v0.4.8

func (m *BTFSDriver) RemoveVolume(name string) error

type BTFSVolume added in v0.4.8

type BTFSVolume struct {
	Options map[string]string
}

func (*BTFSVolume) Configure added in v0.4.8

func (m *BTFSVolume) Configure(mnt Mount, cfg *container.HostConfig) error

type Mount

type Mount struct {
	Source     string
	Target     string
	Permission Permission
}

Mount describes mount settings.

func NewMount

func NewMount(spec string) (Mount, error)

NewMount constructs a new mount settings from the Docker representation in the following format: `VolumeName:ContainerDestination:ro`. For example: `cifs:/mnt:ro`.

func (Mount) ReadOnly

func (m Mount) ReadOnly() bool

ReadOnly returns true if this mount is read-only.

type Option

type Option func(options interface{}) error

Option specifies how a Docker plugin can be configured.

func WithLogger added in v0.4.8

func WithLogger(log *zap.SugaredLogger) Option

func WithOptions

func WithOptions(opts map[string]string) Option

WithOptions constructs an option that forwards the given generic options to the plugin.

func WithPluginSocketDir

func WithPluginSocketDir(path string) Option

WithPluginSocketDir constructs an option that specifies the plugin directory where Unix sockets live.

type Permission

type Permission uint32
const (
	RW Permission = iota
	RO
)

func ParsePermission

func ParsePermission(mode string) (Permission, error)

type Volume

type Volume interface {
	// Configure mutates the specified host config applying required settings.
	Configure(mount Mount, cfg *container.HostConfig) error
}

Volume specifies volume interface, that is mounted within Docker containers.

type VolumeDriver

type VolumeDriver interface {
	// CreateVolume creates a new volume using specified name and Option.
	//
	// This method is called before tuning a new container, so it should
	// prepare all required stuff such as mounting filesystems, create
	// subdirectories, etc.
	// For example for BTFS driver it creates torrent client, mounts FUSE
	// filesystem and tries to fetch the provided magnet URL.
	//
	// Both "name" and "options" parameters are passed directly from the
	// task specification.
	CreateVolume(name string, options map[string]string) (Volume, error)
	// RemoveVolume removes an existing volume.
	RemoveVolume(name string) error
	// Close closes this driver, freeing all associated resources.
	Close() error
}

VolumeDriver specifies volume driver interface, providing abilities to create new volumes for containers.

func NewCIFSVolumeDriver

func NewCIFSVolumeDriver(ctx context.Context, options ...Option) (VolumeDriver, error)

NewCIFSVolumeDriver constructs and runs a new CIFS volume driver within the provided error group.

func NewNilVolumeDriver

func NewNilVolumeDriver() VolumeDriver

NewNilVolumeDriver constructs a new volume driver that does nothing.

Used primarily in systems that are unable to manage Docker plugins for to be able to at least start the Worker.

func NewVolumeDriver

func NewVolumeDriver(ctx context.Context, ty string, options ...Option) (VolumeDriver, error)

NewVolumeDriver constructs a new volume driver.

type VolumeServer added in v0.4.8

type VolumeServer struct {
	// contains filtered or unexported fields
}

func NewVolumeServer added in v0.4.8

func NewVolumeServer(name string, options ...Option) (*VolumeServer, error)

func (*VolumeServer) Close added in v0.4.8

func (m *VolumeServer) Close() error

func (*VolumeServer) Serve added in v0.4.8

func (m *VolumeServer) Serve(driver volume.Driver) error

Jump to

Keyboard shortcuts

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