core

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DriverNames

func DriverNames() <-chan string

DriverNames returns a channel which receives the names of all of the registerd drivers.

func RegisterDriver

func RegisterDriver(driverName string, ctor NewDriver)

RegisterDriver is used by drivers to notify the driver manager of their availability to be used.

Types

type BlockDevice

type BlockDevice struct {

	// The name of the provider that owns the block device.
	ProviderName string

	// The ID of the instance to which the device is connected.
	InstanceID string

	// The ID of the volume for which the device is mounted.
	VolumeID string

	// The name of the device.
	DeviceName string

	// The region from which the device originates.
	Region string

	// The device status.
	Status string

	// The name of the network on which the device resides.
	NetworkName string
}

BlockDevice provides information about a block-storage device.

type Driver

type Driver interface {
	// The name of the driver.
	Name() string

	// Init initalizes the driver so that it is in a state to communicate to
	// its underlying platform / storage provider.
	Init(rexray *RexRay) error
}

Driver represents a REX-Ray driver.

type Instance

type Instance struct {

	// The name of the provider that owns the object.
	ProviderName string

	// The ID of the instance to which the object is connected.
	InstanceID string

	// The region from which the object originates.
	Region string

	// The name of the instance.
	Name string
}

Instance provides information about a storage object.

type MountInfoArray

type MountInfoArray []*mount.Info

MountInfoArray is an alias of []*mount.Info

type NewDriver

type NewDriver func() Driver

NewDriver is a function that constructs a new driver.

type OSDriver

type OSDriver interface {
	Driver

	// Shows the existing mount points
	GetMounts(string, string) (MountInfoArray, error)

	// Check whether path is mounted or not
	Mounted(string) (bool, error)

	// Unmount based on a path
	Unmount(string) error

	// Mount based on a device, target, options, label
	Mount(string, string, string, string) error

	// Format a device with a FS type
	Format(string, string, bool) error
}

OSDriver is the interface implemented by types that provide OS introspection and management.

type OSDriverManager

type OSDriverManager interface {
	OSDriver

	// Drivers gets a channel which receives a list of all of the configured
	// OS drivers.
	Drivers() <-chan OSDriver
}

OSDriverManager acts as both a OSDriverManager and as an aggregate of OS drivers, providing batch methods.

type RexRay

type RexRay struct {
	Config  *config.Config
	OS      OSDriverManager
	Volume  VolumeDriverManager
	Storage StorageDriverManager
	// contains filtered or unexported fields
}

RexRay is the library's entrance type and storage management platform.

func New

func New(conf *config.Config) *RexRay

New creates a new REX-Ray instance and configures it with the provided configuration instance.

func (*RexRay) DriverNames

func (r *RexRay) DriverNames() <-chan string

DriverNames returns a list of the registered driver names.

func (*RexRay) InitDrivers

func (r *RexRay) InitDrivers() error

InitDrivers initializes the drivers for the REX-Ray platform.

type Snapshot

type Snapshot struct {

	// The name of the snapshot.
	Name string

	// The ID of the volume to which the snapshot belongs.
	VolumeID string

	// The snapshot's ID.
	SnapshotID string

	// The size of the volume to which the snapshot belongs/
	VolumeSize string

	// The time at which the request to create the snapshot was submitted.
	StartTime string

	// A description of the snapshot.
	Description string

	// The status of the snapshot.
	Status string
}

Snapshot provides information about a storage-layer snapshot.

type StorageDriver

type StorageDriver interface {
	Driver

	// GetVolumeMapping lists the block devices that are attached to the
	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, volumeID, snapshotID, volumeType string,
		IOPS, 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)
}

StorageDriver is the interface implemented by types that provide storage introspection and management.

type StorageDriverManager

type StorageDriverManager interface {
	StorageDriver

	// Drivers gets a channel which receives a list of all of the configured
	// storage drivers.
	Drivers() <-chan StorageDriver

	// GetInstances gets the instance for each of the configured drivers.
	GetInstances() ([]*Instance, error)
}

StorageDriverManager acts as both a StorageDriverManager and as an aggregate of storage drivers, providing batch methods.

type Volume

type Volume struct {

	// The name of the volume.
	Name string

	// The volume ID.
	VolumeID string

	// The availability zone for which the volume is available.
	AvailabilityZone string

	// The volume status.
	Status string

	// The volume type.
	VolumeType string

	// The volume IOPs.
	IOPS int64

	// The size of the volume.
	Size string

	// The name of the network on which the volume resides.
	NetworkName string

	// The volume's attachments.
	Attachments []*VolumeAttachment
}

Volume provides information about a storage volume.

type VolumeAttachment

type VolumeAttachment struct {

	// The ID of the volume to which the attachment belongs.
	VolumeID string

	// The ID of the instance on which the volume to which the attachment
	// belongs is mounted.
	InstanceID string

	// The name of the device on which the volume to which the object is
	// attached is mounted.
	DeviceName string

	// The status of the attachment.
	Status string
}

VolumeAttachment provides information about an object attached to a storage volume.

type VolumeDriver

type VolumeDriver interface {
	Driver

	// Mount will return a mount point path when specifying either a volumeName
	// or volumeID.  If a overwriteFs boolean is specified it will overwrite
	// the FS based on newFsType if it is detected that there is no FS present.
	Mount(
		volumeName, volumeID string,
		overwriteFs bool, newFsType string) (string, error)

	// Unmount will unmount the specified volume by volumeName or volumeID.
	Unmount(volumeName, volumeID string) error

	// Path will return the mounted path of the volumeName or volumeID.
	Path(volumeName, volumeID string) (string, error)

	// Create will create a new volume with the volumeName and opts.
	Create(volumeName string, opts VolumeOpts) error

	// Remove will remove a volume of volumeName.
	Remove(volumeName string) error

	// Attach will attach a volume based on volumeName to the instance of
	// instanceID.
	Attach(volumeName, instanceID string) (string, error)

	// Detach will detach a volume based on volumeName to the instance of
	// instanceID.
	Detach(volumeName, instanceID string) error

	// NetworkName will return an identifier of a volume that is relevant when
	// corelating a local device to a device that is the volumeName to the
	// local instanceID.
	NetworkName(volumeName, instanceID string) (string, error)
}

VolumeDriver is the interface implemented by types that provide volume introspection and management.

type VolumeDriverManager

type VolumeDriverManager interface {
	VolumeDriver

	// Drivers gets a channel which receives a list of all of the configured
	// volume drivers.
	Drivers() <-chan VolumeDriver

	// UnmountAll unmounts all volumes.
	UnmountAll() error

	// RemoveAll removes all volumes.
	RemoveAll() error

	// DetachAll detaches all volumes attached to the instance of instanceID.
	DetachAll(instanceID string) error
}

VolumeDriverManager acts as both a VolumeDriver and as an aggregate of volume drivers, providing batch methods.

type VolumeOpts

type VolumeOpts map[string]string

VolumeOpts is a map of options used when creating a new volume

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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