Help us shape the future of Go! Take the 2026 Go Developer Survey

storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDriverBlockDeviceDiscovery = errors.New("Driver Block Device discovery failed")
	ErrDriverInstanceDiscovery    = errors.New("Driver Instance discovery failed")
	ErrDriverVolumeDiscovery      = errors.New("Driver Volume discovery failed")
	ErrDriverSnapshotDiscovery    = errors.New("Driver Snapshot discovery failed")
	ErrMultipleDriversDetected    = errors.New("Multiple drivers detected, must declare with driver with env of REXRAY_STORAGEDRIVER=")
)

Functions

func GetDriverNames

func GetDriverNames() []string

func Register

func Register(name string, initFunc InitFunc)

Types

type BlockDevice

type BlockDevice struct {
	ProviderName string
	InstanceID   string
	VolumeID     string
	DeviceName   string
	Region       string
	Status       string
	NetworkName  string
}

type Driver

type Driver interface {
	// GetVolumeMapping lists the block devices that are attached to the instance.
	GetVolumeMapping() ([]*BlockDevice, error)

	// GetInstance retrieves the local instance.
	GetInstance() (*Instance, error)

	// GetVolume returns all volumes for the instance based on either volumeID or volumeName
	// that are available to the instance.
	GetVolume(volumeID, volumeName string) ([]*Volume, error)

	// GetVolumeAttach returns the attachment details based on volumeID or volumeName
	// where the volume is currently attached.
	GetVolumeAttach(volumeID, instanceID string) ([]*VolumeAttachment, error)

	// CreateSnapshot is a synch/async operation that returns snapshots that have been
	// performed based on supplying a snapshotName, source volumeID, and optional description.
	CreateSnapshot(runAsync bool, snapshotName, volumeID, description string) ([]*Snapshot, error)

	// GetSnapshot returns a list of snapshots for a volume based on volumeID, snapshotID, or snapshotName.
	GetSnapshot(volumeID, snapshotID, snapshotName string) ([]*Snapshot, error)

	// RemoveSnapshot will remove a snapshot based on the snapshotID.
	RemoveSnapshot(snapshotID string) error

	// CreateVolume is sync/async and will create an return a new/existing Volume based on volumeID/snapshotID with
	// a name of volumeName and a size in GB.  Optionally based on the storage driver, a volumeType, IOPS, and availabilityZone
	// could be defined.
	CreateVolume(runAsync bool, volumeName string, volumeID string, snapshotID string, volumeType string, IOPS int64, size int64, availabilityZone string) (*Volume, error)

	// RemoveVolume will remove a volume based on volumeID.
	RemoveVolume(volumeID string) error

	// GetDeviceNextAvailable return a device path that will retrieve the next available disk device that can be used.
	GetDeviceNextAvailable() (string, error)

	// AttachVolume returns a list of VolumeAttachments is sync/async that will attach a volume to an instance based on volumeID and instanceID.
	AttachVolume(runAsync bool, volumeID, instanceID string) ([]*VolumeAttachment, error)

	// DetachVolume is sync/async that will detach the volumeID from the local instance or the instanceID.
	DetachVolume(runAsync bool, volumeID string, instanceID string) error

	// CopySnapshot is a sync/async and returns a snapshot that will copy a snapshot based on volumeID/snapshotID/snapshotName and
	// create a new snapshot of desinationSnapshotName in the destinationRegion location.
	CopySnapshot(runAsync bool, volumeID, snapshotID, snapshotName, destinationSnapshotName, destinationRegion string) (*Snapshot, error)
}

type InitFunc

type InitFunc func(conf *config.Config) (Driver, error)

type Instance

type Instance struct {
	ProviderName string
	InstanceID   string
	Region       string
	Name         string
}

type Snapshot

type Snapshot struct {
	Name        string
	VolumeID    string
	SnapshotID  string
	VolumeSize  string
	StartTime   string
	Description string
	Status      string
}

type StorageDriverManager

type StorageDriverManager struct {
	Drivers map[string]Driver
	Config  *config.Config
}

func NewStorageDriverManager

func NewStorageDriverManager(conf *config.Config) (*StorageDriverManager, error)

func (*StorageDriverManager) AttachVolume

func (sdm *StorageDriverManager) AttachVolume(runAsync bool, volumeID string, instanceID string) ([]*VolumeAttachment, error)

func (*StorageDriverManager) CopySnapshot

func (sdm *StorageDriverManager) CopySnapshot(runAsync bool, volumeID, snapshotID, snapshotName, targetSnapshotName, targetRegion string) (*Snapshot, error)

func (*StorageDriverManager) CreateSnapshot

func (sdm *StorageDriverManager) CreateSnapshot(runAsync bool, snapshotName, volumeID, description string) ([]*Snapshot, error)

func (*StorageDriverManager) CreateVolume

func (sdm *StorageDriverManager) CreateVolume(runAsync bool, volumeName string, volumeID, snapshotID string, volumeType string, IOPS int64, size int64, availabilityZone string) (*Volume, error)

func (*StorageDriverManager) DetachVolume

func (sdm *StorageDriverManager) DetachVolume(runAsync bool, volumeID string, instanceID string) error

func (*StorageDriverManager) GetDriverNames

func (sdm *StorageDriverManager) GetDriverNames() []string

func (*StorageDriverManager) GetInstance

func (sdm *StorageDriverManager) GetInstance() ([]*Instance, error)

func (*StorageDriverManager) GetSnapshot

func (sdm *StorageDriverManager) GetSnapshot(volumeID, snapshotID, snapshotName string) ([]*Snapshot, error)

func (*StorageDriverManager) GetVolume

func (sdm *StorageDriverManager) GetVolume(volumeID, volumeName string) ([]*Volume, error)

func (*StorageDriverManager) GetVolumeAttach

func (sdm *StorageDriverManager) GetVolumeAttach(volumeID string, instanceID string) ([]*VolumeAttachment, error)

func (*StorageDriverManager) GetVolumeMapping

func (sdm *StorageDriverManager) GetVolumeMapping() ([]*BlockDevice, error)

GetVolumeMapping performs storage introspection and returns a listing of block devices from the guest

func (*StorageDriverManager) IsDrivers

func (sdm *StorageDriverManager) IsDrivers() bool

func (*StorageDriverManager) RemoveSnapshot

func (sdm *StorageDriverManager) RemoveSnapshot(snapshotID string) error

func (*StorageDriverManager) RemoveVolume

func (sdm *StorageDriverManager) RemoveVolume(volumeID string) error

type Volume

type Volume struct {
	Name             string
	VolumeID         string
	AvailabilityZone string
	Status           string
	VolumeType       string
	IOPS             int64
	Size             string
	NetworkName      string
	Attachments      []*VolumeAttachment
}

type VolumeAttachment

type VolumeAttachment struct {
	VolumeID   string
	InstanceID string
	DeviceName string
	Status     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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