driver

package
v0.0.0-...-a79519d Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alias

func Alias(name, alias string) error

Alias is used to add driver name's alias into exist driver.

func AllDriversName

func AllDriversName() []string

AllDriversName return all registered backend driver's name.

func Exist

func Exist(name string) bool

Exist return true if the backend driver is registered.

func ListDriverOption

func ListDriverOption(name string) map[string]types.Option

ListDriverOption return backend driver's options by name.

func Register

func Register(d Driver) error

Register add a backend driver module.

Types

type AttachDetach

type AttachDetach interface {
	// Attach a Volume to host, enable the volume.
	Attach(Context, *types.Volume) error

	// Detach a volume with host, disable the volume.
	Detach(Context, *types.Volume) error
}

AttachDetach represents volume attach/detach interface.

type Context

type Context struct {
	Log *log.Logger
	// contains filtered or unexported fields
}

Context represents driver context struct.

func Contexts

func Contexts() Context

Contexts returns driver context instance.

func (Context) Add

func (c Context) Add(key string, value interface{})

Add is used to add a key into context data.

func (Context) Del

func (c Context) Del(key string)

Del is used to delete a key from context data.

func (Context) Get

func (c Context) Get(key string) (interface{}, bool)

Get returns content of key from context data.

func (Context) GetInt

func (c Context) GetInt(key string) (int, bool)

GetInt returns int content of key from context data.

func (Context) GetString

func (c Context) GetString(key string) (string, bool)

GetString returns string content of key from context data.

func (Context) New

func (c Context) New() Context

New is used to make a Context instance.

type Driver

type Driver interface {
	// Name returns backend driver's name.
	Name(Context) string

	// StoreMode defines backend driver's store model.
	StoreMode(Context) VolumeStoreMode

	// Create a volume.
	Create(Context, types.VolumeID) (*types.Volume, error)

	// Remove a volume.
	Remove(Context, *types.Volume) error

	// Path returns volume's path.
	Path(Context, *types.Volume) (string, error)
}

Driver represents volume driver base operation interface.

func Get

func Get(name string) (Driver, error)

Get returns one backend driver with specified name.

func GetAll

func GetAll() ([]Driver, error)

GetAll returns all volume drivers.

func NewRemoteDriverWrapper

func NewRemoteDriverWrapper(name string, plugin *plugins.Plugin) Driver

NewRemoteDriverWrapper returns a remote driver

type Formator

type Formator interface {
	// Format a volume.
	Format(Context, *types.Volume) error
}

Formator represents volume format interface.

type Getter

type Getter interface {
	// Get a volume from driver
	Get(Context, string) (*types.Volume, error)
}

Getter represents volume get interface.

type Lister

type Lister interface {
	// List a volume from driver
	List(Context) ([]*types.Volume, error)
}

Lister represents volume list interface

type Opt

type Opt interface {
	// Options return module customize volume options.
	Options() map[string]types.Option
}

Opt represents volume driver option interface.

type VolumeStoreMode

type VolumeStoreMode int

VolumeStoreMode defines volume store mode type.

const (
	// LocalStore defines Local store mode.
	LocalStore VolumeStoreMode = 1

	// RemoteStore defines remote store mode.
	RemoteStore VolumeStoreMode = 2

	// CreateDeleteInCentral defines operate storage on gateway.
	CreateDeleteInCentral VolumeStoreMode = 4

	// UseLocalMetaStore defines store metadata on local host.
	UseLocalMetaStore VolumeStoreMode = 8
)

func (VolumeStoreMode) CentralCreateDelete

func (m VolumeStoreMode) CentralCreateDelete() bool

CentralCreateDelete checks VolumeStoreMode is center mode of operation or not.

func (VolumeStoreMode) IsLocal

func (m VolumeStoreMode) IsLocal() bool

IsLocal checks VolumeStoreMode is local mode or not.

func (VolumeStoreMode) IsRemote

func (m VolumeStoreMode) IsRemote() bool

IsRemote checks VolumeStoreMode is remote mode or not.

func (VolumeStoreMode) String

func (m VolumeStoreMode) String() string

String returns VolumeStoreMode with string description.

func (VolumeStoreMode) UseLocalMeta

func (m VolumeStoreMode) UseLocalMeta() bool

UseLocalMeta checks VolumeStoreMode is store metadata on local or not.

func (VolumeStoreMode) Valid

func (m VolumeStoreMode) Valid() bool

Valid is used to check VolumeStoreMode is valid or not.

Jump to

Keyboard shortcuts

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