driver

package
v0.0.0-...-8680cc4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 12 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 Register

func Register(d Driver) error

Register add a backend driver module.

func Unregister

func Unregister(name string) bool

Unregister deletes a driver from driverTable

Types

type AttachDetach

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

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

AttachDetach represents volume attach/detach interface.

type Conf

type Conf interface {
	// Config is used to pass the daemon volume config into driver.
	Config(context.Context, map[string]interface{}) error
}

Conf represents pass volume config to volume driver.

type Driver

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

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

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

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

	// Path returns volume's path.
	Path(context.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 NewFakeDriver

func NewFakeDriver(name string) Driver

NewFakeDriver returns a fake voluem driver.

func NewRemoteDriverWrapper

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

NewRemoteDriverWrapper returns a remote driver

type FakeDriver

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

FakeDriver is a fake volume driver.

func (*FakeDriver) Create

func (f *FakeDriver) Create(ctx context.Context, id types.VolumeContext) (*types.Volume, error)

Create a fake volume

func (*FakeDriver) Name

func (f *FakeDriver) Name(ctx context.Context) string

Name returns the fake driver's name.

func (*FakeDriver) Path

func (f *FakeDriver) Path(ctx context.Context, volume *types.Volume) (string, error)

Path returns fake volume's path.

func (*FakeDriver) Remove

func (f *FakeDriver) Remove(ctx context.Context, volume *types.Volume) error

Remove a fake volume

func (*FakeDriver) StoreMode

func (f *FakeDriver) StoreMode(ctx context.Context) VolumeStoreMode

StoreMode returns the fake driver's store model.

type Formator

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

Formator represents volume format interface.

type Getter

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

Getter represents volume get interface.

type Lister

type Lister interface {
	// List a volume from driver
	List(context.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