driver

package
v0.0.0-...-2812ca0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllDriversName

func AllDriversName() []string

AllDriversName return all 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, *types.Storage) error

	// Detach a volume with host, disable the volume.
	Detach(Context, *types.Volume, *types.Storage) 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.Volume, *types.Storage) error

	// Remove a volume.
	Remove(Context, *types.Volume, *types.Storage) 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, bool)

Get return one backend driver with specified name.

func List

func List() []Driver

List return all backend drivers.

type Formator

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

Formator represents volume format interface.

type GatewayDriver

type GatewayDriver interface {
	// Report storage cluster status.
	Report(Context) ([]*types.Storage, error)
}

GatewayDriver represents storage gateway 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