Documentation ¶
Index ¶
- Constants
- Variables
- func BackCompat(config gofig.Config)
- type APIClient
- type APIFunc
- type Client
- type ClientDriver
- type ClientType
- type ConfigKey
- type Context
- type ContextLoggerFieldAware
- type ContextLoggerFieldsAware
- type DeviceFormatOpts
- type DeviceMountOpts
- type DeviceScanType
- type Driver
- type DriverInfo
- type EndpointType
- type ErrBadAdminToken
- type ErrBadFilter
- type ErrBatchProcess
- type ErrContextKey
- type ErrContextType
- type ErrDriverTypeErr
- type ErrMissingInstanceID
- type ErrNotFound
- type ErrStoreKey
- type ErrUnsupportedForClientType
- type ExecutorInfo
- type ExecutorsMap
- type FieldLogger
- type Filter
- type FilterOperator
- type Instance
- type InstanceID
- func (i *InstanceID) DeleteMetadata()
- func (i *InstanceID) HasMetadata() bool
- func (i *InstanceID) MarshalJSON() ([]byte, error)
- func (i *InstanceID) MarshalMetadata(data interface{}) error
- func (i *InstanceID) MarshalText() ([]byte, error)
- func (i *InstanceID) MarshalYAML() (interface{}, error)
- func (i *InstanceID) String() string
- func (i *InstanceID) UnmarshalJSON(data []byte) error
- func (i *InstanceID) UnmarshalMetadata(dest interface{}) error
- func (i *InstanceID) UnmarshalText(value []byte) error
- type InstanceIDMap
- type IntegrationDriver
- type IntegrationDriverManager
- type Level
- type LocalDevices
- func (l *LocalDevices) MarshalJSON() ([]byte, error)
- func (l *LocalDevices) MarshalText() ([]byte, error)
- func (l *LocalDevices) MarshalYAML() (interface{}, error)
- func (l *LocalDevices) String() string
- func (l *LocalDevices) UnmarshalJSON(data []byte) error
- func (l *LocalDevices) UnmarshalText(value []byte) error
- type LocalDevicesMap
- type LocalDevicesOpts
- type LogEntry
- type Middleware
- type MiddlewareFunc
- type MountInfo
- type NewClientDriver
- type NewIntegrationDriver
- type NewOSDriver
- type NewRequestObjFunc
- type NewStorageDriver
- type NewStorageExecutor
- type NextDeviceInfo
- type OSDriver
- type OSDriverManager
- type ProvidesAPIClient
- type ProvidesStorageExecutorCLI
- type Route
- type Router
- type Server
- type Service
- type ServiceInfo
- type ServiceSnapshotMap
- type ServiceVolumeMap
- type Services
- type ServicesMap
- type Snapshot
- type SnapshotCopyRequest
- type SnapshotMap
- type SnapshotRemoveRequest
- type StorageDriver
- type StorageDriverManager
- type StorageDriverWithLogin
- type StorageExecutor
- type StorageExecutorCLI
- type StorageExecutorFunctions
- type StorageExecutorWithSupported
- type StorageService
- type StorageTaskRunFunc
- type StorageType
- type Store
- type Task
- type TaskExecutionService
- type TaskRunFunc
- type TaskState
- type TaskTrackingService
- type Transaction
- type TxTimestamp
- type UUID
- type VersionInfo
- type Volume
- type VolumeAttachOpts
- type VolumeAttachRequest
- type VolumeAttachResponse
- type VolumeAttachment
- type VolumeCopyRequest
- type VolumeCreateOpts
- type VolumeCreateRequest
- type VolumeDetachOpts
- type VolumeDetachRequest
- type VolumeDevice
- type VolumeInspectOpts
- type VolumeMap
- type VolumeMapping
- type VolumeMountOpts
- type VolumeSnapshotRequest
- type VolumesOpts
- type WaitForDeviceOpts
Constants ¶
const ( // ConfigRoot is a config key. ConfigRoot = "libstorage" // ConfigServer is a config key. ConfigServer = ConfigRoot + ".server" // ConfigClient is a config key. ConfigClient = ConfigRoot + ".client" // ConfigClientType is a config key. ConfigClientType = ConfigClient + ".type" // ConfigHost is a config key. ConfigHost = ConfigRoot + ".host" // ConfigEmbedded is a config key. ConfigEmbedded = ConfigRoot + ".embedded" // ConfigService is a config key. ConfigService = ConfigRoot + ".service" // ConfigOSDriver is a config key. ConfigOSDriver = ConfigRoot + ".os.driver" // ConfigStorageDriver is a config key. ConfigStorageDriver = ConfigRoot + ".storage.driver" // ConfigIntegrationDriver is a config key. ConfigIntegrationDriver = ConfigRoot + ".integration.driver" // ConfigLogging is a config key. ConfigLogging = ConfigRoot + ".logging" // ConfigLogLevel is a config key. ConfigLogLevel = ConfigLogging + ".level" // ConfigLogStdout is a config key. ConfigLogStdout = ConfigLogging + ".stdout" // ConfigLogStderr is a config key. ConfigLogStderr = ConfigLogging + ".stderr" // ConfigLogHTTPRequests is a config key. ConfigLogHTTPRequests = ConfigLogging + ".httpRequests" // ConfigLogHTTPResponses is a config key. ConfigLogHTTPResponses = ConfigLogging + ".httpResponses" // ConfigHTTPDisableKeepAlive is a config key. ConfigHTTPDisableKeepAlive = ConfigRoot + ".http.disableKeepAlive" // ConfigHTTPWriteTimeout is a config key. ConfigHTTPWriteTimeout = ConfigRoot + ".http.writeTimeout" // ConfigHTTPReadTimeout is a config key. ConfigHTTPReadTimeout = ConfigRoot + ".http.readTimeout" // ConfigServices is a config key. ConfigServices = ConfigServer + ".services" // ConfigServerAutoEndpointMode is a config key. ConfigServerAutoEndpointMode = ConfigServer + ".autoEndpointMode" // ConfigEndpoints is a config key. ConfigEndpoints = ConfigServer + ".endpoints" // ConfigExecutorPath is a config key. ConfigExecutorPath = ConfigRoot + ".executor.path" // ConfigExecutorNoDownload is a config key. ConfigExecutorNoDownload = ConfigRoot + ".executor.disableDownload" // ConfigClientCacheInstanceID is a config key. ConfigClientCacheInstanceID = ConfigClient + ".cache.instanceID" // ConfigTLS is a config key. ConfigTLS = ConfigRoot + ".tls" // ConfigTLSDisabled is a config key. ConfigTLSDisabled = ConfigTLS + ".disabled" // ConfigTLSServerName is a config key. ConfigTLSServerName = ConfigTLS + ".serverName" // ConfigTLSClientCertRequired is a config key. ConfigTLSClientCertRequired = ConfigTLS + ".clientCertRequired" // ConfigTLSTrustedCertsFile is a config key. ConfigTLSTrustedCertsFile = ConfigTLS + ".trustedCertsFile" // ConfigTLSCertFile is a config key. ConfigTLSCertFile = ConfigTLS + ".certFile" // ConfigTLSKeyFile is a config key. ConfigTLSKeyFile = ConfigTLS + ".keyFile" // ConfigDeviceAttachTimeout is a config key. ConfigDeviceAttachTimeout = ConfigRoot + ".device.attachTimeout" // ConfigDeviceScanType is a config key. ConfigDeviceScanType = ConfigRoot + ".device.scanType" // ConfigSchemaResponseValidationEnabled is a config key. ConfigSchemaResponseValidationEnabled = ConfigRoot + ".schema.responseValidationEnabled" // ConfigServerTasks is a config key. ConfigServerTasks = ConfigServer + ".tasks" // ConfigServerTasksExeTimeout is a config key. ConfigServerTasksExeTimeout = ConfigServerTasks + ".exeTimeout" // ConfigServerTasksLogTimeout is a config key. ConfigServerTasksLogTimeout = ConfigServerTasks + ".logTimeout" )
const ( //ConfigOldRoot is a config key. ConfigOldRoot = "volume" // ConfigOldIntegrationVolMountPreempt is a config key. ConfigOldIntegrationVolMountPreempt = ConfigOldRoot + ".mount.preempt" // ConfigOldIntegrationVolCreateDisable is a config key. ConfigOldIntegrationVolCreateDisable = ConfigOldRoot + ".create.disable" // ConfigOldIntegrationVolRemoveDisable is a config key. ConfigOldIntegrationVolRemoveDisable = ConfigOldRoot + ".remove.disable" // ConfigOldIntegrationVolUnmountIgnoreUsed is a config key. ConfigOldIntegrationVolUnmountIgnoreUsed = ConfigOldRoot + ".unmount.ignoreusedcount" // ConfigOldIntegrationVolPathCache is a config key. ConfigOldIntegrationVolPathCache = ConfigOldRoot + ".path.cache" //ConfigOldDocker is a config key. ConfigOldDocker = "docker" //ConfigOldDockerFsType is a config key. ConfigOldDockerFsType = ConfigOldDocker + ".fsType" //ConfigOldDockerVolumeType is a config key. ConfigOldDockerVolumeType = ConfigOldDocker + ".volumeType" //ConfigOldDockerIOPS is a config key. ConfigOldDockerIOPS = ConfigOldDocker + ".iops" //ConfigOldDockerSize is a config key. ConfigOldDockerSize = ConfigOldDocker + ".size" //ConfigOldDockerAvailabilityZone is a config key. ConfigOldDockerAvailabilityZone = ConfigOldDocker + ".availabilityZone" //ConfigOldDockerMountDirPath is a config key. ConfigOldDockerMountDirPath = ConfigOldDocker + ".mountDirPath" //ConfigOldDockerLinuxVolumeRootPath is a config key. ConfigOldDockerLinuxVolumeRootPath = "linux.volume.rootpath" )
const ( //ConfigIg is a config key. ConfigIg = ConfigRoot + ".integration" //ConfigIgVol is a config key. ConfigIgVol = ConfigIg + ".volume" //ConfigIgVolOps is a config key. ConfigIgVolOps = ConfigIgVol + ".operations" //ConfigIgVolOpsMount is a config key. ConfigIgVolOpsMount = ConfigIgVolOps + ".mount" //ConfigIgVolOpsMountPreempt is a config key. ConfigIgVolOpsMountPreempt = ConfigIgVolOpsMount + ".preempt" //ConfigIgVolOpsMountPath is a config key. ConfigIgVolOpsMountPath = ConfigIgVolOpsMount + ".path" //ConfigIgVolOpsMountRootPath is a config key. ConfigIgVolOpsMountRootPath = ConfigIgVolOpsMount + ".rootPath" //ConfigIgVolOpsUnmount is a config key. ConfigIgVolOpsUnmount = ConfigIgVolOps + ".unmount" //ConfigIgVolOpsUnmountIgnoreUsed is a config key. ConfigIgVolOpsUnmountIgnoreUsed = ConfigIgVolOpsUnmount + ".ignoreusedcount" // ConfigIgVolOpsPath is a config key. ConfigIgVolOpsPath = ConfigIgVolOps + ".path" // ConfigIgVolOpsPathCache is a config key. ConfigIgVolOpsPathCache = ConfigIgVolOpsPath + ".cache" // ConfigIgVolOpsPathCacheEnabled is a config key. ConfigIgVolOpsPathCacheEnabled = ConfigIgVolOpsPathCache + ".enabled" // ConfigIgVolOpsPathCacheAsync is a config key. ConfigIgVolOpsPathCacheAsync = ConfigIgVolOpsPathCache + ".async" // ConfigIgVolOpsCreate is a config key. ConfigIgVolOpsCreate = ConfigIgVolOps + ".create" // ConfigIgVolOpsCreateDisable is a config key. ConfigIgVolOpsCreateDisable = ConfigIgVolOpsCreate + ".disable" // ConfigIgVolOpsCreateImplicit is a config key. ConfigIgVolOpsCreateImplicit = ConfigIgVolOpsCreate + ".implicit" // ConfigIgVolOpsCreateDefault is a config key. ConfigIgVolOpsCreateDefault = ConfigIgVolOpsCreate + ".default" // ConfigIgVolOpsCreateDefaultSize is a config key. ConfigIgVolOpsCreateDefaultSize = ConfigIgVolOpsCreateDefault + ".size" // ConfigIgVolOpsCreateDefaultFsType is a config key. ConfigIgVolOpsCreateDefaultFsType = ConfigIgVolOpsCreateDefault + ".fsType" // ConfigIgVolOpsCreateDefaultAZ is a config key. ConfigIgVolOpsCreateDefaultAZ = ConfigIgVolOpsCreateDefault + ".availabilityZone" // ConfigIgVolOpsCreateDefaultType is a config key. ConfigIgVolOpsCreateDefaultType = ConfigIgVolOpsCreateDefault + ".type" // ConfigIgVolOpsCreateDefaultIOPS is a config key. ConfigIgVolOpsCreateDefaultIOPS = ConfigIgVolOpsCreateDefault + ".IOPS" // ConfigIgVolOpsRemove is a config key. ConfigIgVolOpsRemove = ConfigIgVolOps + ".remove" // ConfigIgVolOpsRemoveDisable is a config key. ConfigIgVolOpsRemoveDisable = ConfigIgVolOpsRemove + ".disable" )
const ( // LSXExitCodeNotImplemented is the exit code the executor binary uses to // indicate a function is not implemented for a given storage driver on the // current system. LSXExitCodeNotImplemented = 2 // LSXExitCodeTimedOut is the exit code the executor binary uses to indicate // a function timed out. LSXExitCodeTimedOut = 255 // LSXCmdInstanceID is the command to execute to get the instance ID. LSXCmdInstanceID = "instanceID" // LSXCmdLocalDevices is the command to execute to get the local devices // map. LSXCmdLocalDevices = "localDevices" // LSXCmdNextDevice is the command to execute to get the next device. LSXCmdNextDevice = "nextDevice" // LSXCmdWaitForDevice is the command to execute to wait until a device, // identified by volume ID, is presented to the system. LSXCmdWaitForDevice = "wait" // LSXCmdSupported is the command to execute to find out if an executor // is valid for a given platform on the current host. LSXCmdSupported = "supported" )
const ( // InstanceIDHeader is the HTTP header that contains an InstanceID. InstanceIDHeader = "Libstorage-Instanceid" // LocalDevicesHeader is the HTTP header that contains a local device pair. LocalDevicesHeader = "Libstorage-Localdevices" // TransactionHeader is the HTTP header that contains the transaction // sent from the client. TransactionHeader = "Libstorage-Tx" // ServerNameHeader is the HTTP header that contains the randomly generated // name the server creates for unique identification when the server starts // for the first time. This header is provided with every response sent // from the server. ServerNameHeader = "Libstorage-Servername" )
All header names below follow the Golang canonical format for header keys. Please do not alter their casing to your liking or you will break stuff.
const ( // TaskStateQueued is the state for a task that has been enqueued but not // yet started. TaskStateQueued TaskState = "queued" // TaskStateRunning is the state for a task that is running. TaskStateRunning = "running" // TaskStateSuccess is the state for a task that has completed successfully. TaskStateSuccess = "success" // TaskStateError is the state for a task that has completed with an error. TaskStateError = "error" )
const ( // Home is the application home directory. Home fileKey = iota // Etc is the application etc directory. Etc // Lib is the application lib directory. Lib // Log is the application log directory. Log // Run is the application run directory. Run // LSX is the path to the libStorage executor. LSX )
const LibStorageDriverName = "libstorage"
LibStorageDriverName is the name of the libStorage storage driver.
Variables ¶
var ( // ErrIIDMetadataNil is returned by *InstanceID.UnmarshalMetadata when // the InstanceID's metadata is empty or nil. ErrIIDMetadataNil = goof.New("cannot unmarshal nil metadata") // ErrIIDMetadataNilData is returned by *InstanceID.MarshalMetadata when // the provided object to marshal is nil. ErrIIDMetadataNilData = goof.New("cannot marshal nil metadata") // ErrIIDMetadataNilDest is returned by *InstanceID.UnmarshalMetadata when // the provided destination into which the metadata should be unmarshaled // is nil. ErrIIDMetadataNilDest = goof.New("cannot unmarshal into nil receiver") )
var (
// Debug is a flag that indicates whether or not the environment variable
// `LIBSTORAGE_DEBUG` is set to a boolean true value.
Debug, _ = strconv.ParseBool(os.Getenv("LIBSTORAGE_DEBUG"))
)
var ErrNotImplemented = goof.New("not implemented")
ErrNotImplemented is the error that Driver implementations should return if a function is not implemented.
var ErrTimedOut = goof.New("timed out")
ErrTimedOut is the error that is used to indicate an operation timed out.
Functions ¶
func BackCompat ¶
BackCompat ensures keys can be used from old configurations.
Types ¶
type APIClient ¶
type APIClient interface { // ServerName returns the name of the server to which the client is // connected. This is not the same as the host name, rather it's the // randomly generated name the server creates for unique identification // when the server starts for the first time. ServerName() string // LogRequests enables or disables the logging of client HTTP requests. LogRequests(enabled bool) // LogResponses enables or disables the logging of client HTTP responses. LogResponses(enabled bool) // Root returns a list of root resources. Root(ctx Context) ([]string, error) // Instances returns a list of instances. Instances(ctx Context) (map[string]*Instance, error) // InstanceInspect inspects an instance. InstanceInspect(ctx Context, service string) (*Instance, error) // Services returns a map of the configured Services. Services(ctx Context) (map[string]*ServiceInfo, error) // ServiceInspect returns information about a service. ServiceInspect(ctx Context, name string) (*ServiceInfo, error) // Volumes returns a list of all Volumes for all Services. Volumes( ctx Context, attachments bool) (ServiceVolumeMap, error) // VolumesByService returns a list of all Volumes for a service. VolumesByService( ctx Context, service string, attachments bool) (VolumeMap, error) // VolumeInspect gets information about a single volume. VolumeInspect( ctx Context, service, volumeID string, attachments bool) (*Volume, error) // VolumeCreate creates a single volume. VolumeCreate( ctx Context, service string, request *VolumeCreateRequest) (*Volume, error) // VolumeCreateFromSnapshot creates a single volume from a snapshot. VolumeCreateFromSnapshot( ctx Context, service, snapshotID string, request *VolumeCreateRequest) (*Volume, error) // VolumeCopy copies a single volume. VolumeCopy( ctx Context, service, volumeID string, request *VolumeCopyRequest) (*Volume, error) // VolumeRemove removes a single volume. VolumeRemove( ctx Context, service, volumeID string) error // VolumeAttach attaches a single volume. VolumeAttach( ctx Context, service string, volumeID string, request *VolumeAttachRequest) (*Volume, string, error) // VolumeDetach attaches a single volume. VolumeDetach( ctx Context, service string, volumeID string, request *VolumeDetachRequest) (*Volume, error) // VolumeDetachAll attaches all volumes from all VolumeDetachAll( ctx Context, request *VolumeDetachRequest) (ServiceVolumeMap, error) // VolumeDetachAllForService detaches all volumes from a service. VolumeDetachAllForService( ctx Context, service string, request *VolumeDetachRequest) (VolumeMap, error) // VolumeSnapshot creates a single snapshot. VolumeSnapshot( ctx Context, service string, volumeID string, request *VolumeSnapshotRequest) (*Snapshot, error) // Snapshots returns a list of all Snapshots for all Snapshots(ctx Context) (ServiceSnapshotMap, error) // SnapshotsByService returns a list of all Snapshots for a single service. SnapshotsByService( ctx Context, service string) (SnapshotMap, error) // SnapshotInspect gets information about a single snapshot. SnapshotInspect( ctx Context, service, snapshotID string) (*Snapshot, error) // SnapshotRemove removes a single snapshot. SnapshotRemove( ctx Context, service, snapshotID string) error // SnapshotCopy copies a snapshot to a new snapshot. SnapshotCopy( ctx Context, service, snapshotID string, request *SnapshotCopyRequest) (*Snapshot, error) // Executors returns information about the executors. Executors( ctx Context) (map[string]*ExecutorInfo, error) // ExecutorHead returns information about an executor. ExecutorHead( ctx Context, name string) (*ExecutorInfo, error) // ExecutorGet downloads an executor. ExecutorGet( ctx Context, name string) (io.ReadCloser, error) }
APIClient is the libStorage API client used for communicating with a remote libStorage endpoint.
type APIFunc ¶
APIFunc is an adapter to allow the use of ordinary functions as API endpoints. Any function that has the appropriate signature can be register as an API endpoint.
type Client ¶
type Client interface { // API returns the underlying libStorage API client. API() APIClient // OS returns the client's OS driver instance. OS() OSDriver // Storage returns the client's storage driver instance. Storage() StorageDriver // IntegrationDriver returns the client's integration driver instance. Integration() IntegrationDriver // Executor returns the storage executor CLI. Executor() StorageExecutorCLI }
Client is the libStorage client.
type ClientDriver ¶
type ClientDriver interface { Driver // InstanceInspectBefore may return an error, preventing the operation. InstanceInspectBefore(ctx *Context) error // InstanceInspectAfter provides an opportunity to inspect/mutate the // result. InstanceInspectAfter(ctx Context, result *Instance) // VolumesBefore may return an error, preventing the operation. VolumesBefore(ctx *Context) error // VolumesAfter provides an opportunity to inspect/mutate the result. VolumesAfter(ctx Context, result *ServiceVolumeMap) // VolumesByServiceBefore may return an error, preventing the operation. VolumesByServiceBefore(ctx *Context, service string) error // VolumesByServiceAfter provides an opportunity to inspect/mutate the // result. VolumesByServiceAfter( ctx Context, service string, result *VolumeMap) // VolumeInspectBefore may return an error, preventing the operation. VolumeInspectBefore( ctx *Context, service, volumeID string, attachments bool) error // VolumeInspectAfter provides an opportunity to inspect/mutate the result. VolumeInspectAfter(ctx Context, result *Volume) // VolumeCreateBefore may return an error, preventing the operation. VolumeCreateBefore( ctx *Context, service string, request *VolumeCreateRequest) error // VolumeCreateAfter provides an opportunity to inspect/mutate the result. VolumeCreateAfter(ctx Context, result *Volume) // VolumeCreateFromSnapshotBefore may return an error, preventing the // operation. VolumeCreateFromSnapshotBefore( ctx *Context, service, snapshotID string, request *VolumeCreateRequest) error // VolumeCreateFromSnapshotAfter provides an opportunity to inspect/mutate // the result. VolumeCreateFromSnapshotAfter(ctx Context, result *Volume) // VolumeCopyBefore may return an error, preventing the operation. VolumeCopyBefore( ctx *Context, service, volumeID string, request *VolumeCopyRequest) error // VolumeCopyAfter provides an opportunity to inspect/mutate the result. VolumeCopyAfter(ctx Context, result *Volume) // VolumeRemoveBefore may return an error, preventing the operation. VolumeRemoveBefore( ctx *Context, service, volumeID string) error // VolumeRemoveAfter provides an opportunity to inspect/mutate the result. VolumeRemoveAfter(ctx Context, service, volumeID string) // VolumeSnapshotBefore may return an error, preventing the operation. VolumeSnapshotBefore( ctx *Context, service, volumeID string, request *VolumeSnapshotRequest) error // VolumeSnapshotAfter provides an opportunity to inspect/mutate the result. VolumeSnapshotAfter(ctx Context, result *Snapshot) // VolumeAttachBefore may return an error, preventing the operation. VolumeAttachBefore( ctx *Context, service, volumeID string, request *VolumeAttachRequest) error // VolumeAttachAfter provides an opportunity to inspect/mutate the result. VolumeAttachAfter(ctx Context, result *Volume) // VolumeDetachBefore may return an error, preventing the operation. VolumeDetachBefore( ctx *Context, service, volumeID string, request *VolumeDetachRequest) error // VolumeDetachAfter provides an opportunity to inspect/mutate the result. VolumeDetachAfter(ctx Context, result *Volume) // SnapshotsBefore may return an error, preventing the operation. SnapshotsBefore(ctx *Context) error // SnapshotsAfter provides an opportunity to inspect/mutate the result. SnapshotsAfter(ctx Context, result *ServiceSnapshotMap) // SnapshotsByServiceBefore may return an error, preventing the operation. SnapshotsByServiceBefore(ctx *Context, service string) error // SnapshotsByServiceAfter provides an opportunity to inspect/mutate the // result. SnapshotsByServiceAfter( ctx Context, service string, result *SnapshotMap) // SnapshotInspectBefore may return an error, preventing the operation. SnapshotInspectBefore( ctx *Context, service, snapshotID string) error // SnapshotInspectAfter provides an opportunity to inspect/mutate the // result. SnapshotInspectAfter(ctx Context, result *Volume) // SnapshotCopyBefore may return an error, preventing the operation. SnapshotCopyBefore( ctx *Context, service, snapshotID, string, request *SnapshotCopyRequest) error // SnapshotCopyAfter provides an opportunity to inspect/mutate the result. SnapshotCopyAfter(ctx Context, result *Snapshot) // SnapshotRemoveBefore may return an error, preventing the operation. SnapshotRemoveBefore(ctx *Context, service, snapshotID string) error // SnapshotRemoveAfter provides an opportunity to inspect/mutate the result. SnapshotRemoveAfter(ctx Context, snapshotID string) }
ClientDriver is the client-side driver that is able to inspect methods before and after they are invoked in order to both prevent their execution as well as mutate the results.
type ClientType ¶ added in v0.1.1
type ClientType int
ClientType is a client's type.
const ( // UnknownClientType is an unknown client type. UnknownClientType ClientType = iota // IntegrationClient is the default client type -- a client that both // communicates with a remote libStorage endpoint as well as interacts with // the local host. IntegrationClient // ControllerClient is a libStorage client that has no interaction with // the local host, removing any need for access to libStorage executors. ControllerClient )
func ParseClientType ¶ added in v0.1.1
func ParseClientType(str string) ClientType
ParseClientType parses a new client type.
func (ClientType) String ¶ added in v0.1.1
func (t ClientType) String() string
String returns the client type's string representation.
type Context ¶
type Context interface { context.Context FieldLogger // WithValue returns a copy of parent in which the value associated with // key is val. WithValue(key, value interface{}) Context // Join joins this context with another, such that value lookups will first // first check the current context, and if no such value exist, a lookup // will be performed against the right side. Join(ctx context.Context) Context }
Context is a libStorage context.
type ContextLoggerFieldAware ¶
type ContextLoggerFieldAware interface { // ContextLoggerField is the fields that is logged as part of a Context's // log entry. ContextLoggerField() (string, interface{}) }
ContextLoggerFieldAware is used by types that will be logged by the Context logger. The key/value pair returned by the type is then emitted as part of the Context's log entry.
type ContextLoggerFieldsAware ¶
type ContextLoggerFieldsAware interface { // ContextLoggerFields are the fields that are logged as part of a // Context's log entry. ContextLoggerFields() map[string]interface{} }
ContextLoggerFieldsAware is used by types that will be logged by the Context logger. The fields returned by the type are then emitted as part of the Context's log entry.
type DeviceFormatOpts ¶
DeviceFormatOpts are options when formatting a device.
type DeviceMountOpts ¶
DeviceMountOpts are options when mounting a device.
type DeviceScanType ¶
type DeviceScanType int
DeviceScanType is a type of device scan algorithm.
const ( // DeviceScanQuick performs a shallow, quick scan. DeviceScanQuick DeviceScanType = iota // DeviceScanDeep performs a deep, longer scan. DeviceScanDeep )
func ParseDeviceScanType ¶
func ParseDeviceScanType(i interface{}) DeviceScanType
ParseDeviceScanType parses a device scan type.
func (DeviceScanType) String ¶
func (st DeviceScanType) String() string
String returns the string representation of a DeviceScanType.
type Driver ¶
type Driver interface { // Name returns the name of the driver Name() string // Init initializes the driver. Init(ctx Context, config gofig.Config) error }
Driver is the base interface for a libStorage driver.
type DriverInfo ¶
type DriverInfo struct { // Name is the driver's name. Name string `json:"name"` // Type is the type of storage the driver provides: block, nas, object. Type StorageType `json:"type"` // NextDevice is the next available device information for the service. NextDevice *NextDeviceInfo `json:"nextDevice,omitempty" yaml:"nextDevice,omitempty"` }
DriverInfo is information about a driver.
type EndpointType ¶ added in v0.1.1
type EndpointType int
EndpointType is a type of endpoint.
const ( // UnknownEndpointType is an unknown endpoint type. UnknownEndpointType EndpointType = iota // UnixEndpoint is a UNIX socket endpoint. UnixEndpoint // TCPEndpoint is a TCP endpoint. TCPEndpoint )
func ParseEndpointType ¶ added in v0.1.1
func ParseEndpointType(str string) EndpointType
ParseEndpointType parses the endpoint type.
func (EndpointType) String ¶ added in v0.1.1
func (t EndpointType) String() string
String returns the endpoint type's string representation.
type ErrBadAdminToken ¶ added in v0.1.1
ErrBadAdminToken occurs when a bad admin token is provided.
type ErrBadFilter ¶
ErrBadFilter occurs when a bad filter is supplied via the filter query string.
type ErrBatchProcess ¶
ErrBatchProcess occurs when a batch process is interrupted by an error before the process is complete. This error will contain information about the objects for which the process did complete.
type ErrContextKey ¶
ErrContextKey occurs when no value exists for a specified context key.
type ErrContextType ¶
ErrContextType occurs when a value exists in the context but is not the expected typed.
type ErrDriverTypeErr ¶
ErrDriverTypeErr occurs when a Driver is constructed with an invalid type.
type ErrMissingInstanceID ¶
ErrMissingInstanceID occurs when an operation requires the instance ID for the configured service to be avaialble.
type ErrNotFound ¶
ErrNotFound occurs when a Driver inspects or sends an operation to a resource that cannot be found.
type ErrStoreKey ¶
ErrStoreKey occurs when no value exists for a specified store key.
type ErrUnsupportedForClientType ¶ added in v0.1.1
ErrUnsupportedForClientType is the error that occurs when an operation is invoked that is unsupported for the current client type.
type ExecutorInfo ¶
type ExecutorInfo struct { // Name is the name of the executor. Name string `json:"name"` // MD5Checksum is the MD5 checksum of the executor. This can be used to // determine if a local copy of the executor needs to be updated. MD5Checksum string `json:"md5checksum" yaml:"md5checksum"` // Size is the size of the executor in bytes. Size int64 `json:"size"` // LastModified is the time the executor was last modified as an epoch. LastModified int64 `json:"lastModified" yaml:"lastModified"` }
ExecutorInfo contains information about a client-side executor, such as its name and MD5 checksum.
type ExecutorsMap ¶
type ExecutorsMap map[string]*ExecutorInfo
ExecutorsMap is the response when getting one to many ExecutorInfos.
type FieldLogger ¶ added in v0.1.5
type FieldLogger interface { WithField(key string, value interface{}) LogEntry WithFields(fields logrus.Fields) LogEntry WithError(err error) LogEntry Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Printf(format string, args ...interface{}) Warnf(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Print(args ...interface{}) Warn(args ...interface{}) Warning(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Panic(args ...interface{}) Debugln(args ...interface{}) Infoln(args ...interface{}) Println(args ...interface{}) Warnln(args ...interface{}) Warningln(args ...interface{}) Errorln(args ...interface{}) Fatalln(args ...interface{}) Panicln(args ...interface{}) }
FieldLogger interface generalizes the Entry and Logger types
type Filter ¶
type Filter struct { // Op is the operation. Op FilterOperator // Children is a list of any sub-filters if this filter is a compound // filter. Children []*Filter // Left is the left operand. Left string // Right is the right operand. Right string }
Filter is an LDAP-style filter string.
type FilterOperator ¶
type FilterOperator int
FilterOperator is a filter operator.
const ( // FilterAnd is the & operator. FilterAnd FilterOperator = iota // FilterOr is the | operator. FilterOr // FilterNot is the ! operator. FilterNot // FilterPresent is the =* operator. FilterPresent // FilterEqualityMatch is the = operator. FilterEqualityMatch // FilterSubstrings is the = operator in conjunction with a string that // has leading and trailing * characters. FilterSubstrings // FilterSubstringsPrefix is the = operator in conjunction with a string // that has a leading * character. FilterSubstringsPrefix // FilterSubstringsPostfix is the = operator in conjunction with a string // that has a trailing * character. FilterSubstringsPostfix // FilterGreaterOrEqual is the >= operator. FilterGreaterOrEqual // FilterLessOrEqual is the <= operator. FilterLessOrEqual // FilterApproxMatch is the ~= operator. FilterApproxMatch )
type Instance ¶
type Instance struct { // The ID of the instance to which the object is connected. InstanceID *InstanceID `json:"instanceID" yaml:"instanceID,omitempty"` // The name of the instance. Name string `json:"name,omitempty" yaml:",omitempty"` // The name of the provider that owns the object. ProviderName string `json:"providerName" yaml:"providerName,omitempty"` // The region from which the object originates. Region string `json:"region,omitempty" yaml:",omitempty"` // Fields are additional properties that can be defined for this type. Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"` }
Instance provides information about a storage object.
type InstanceID ¶
type InstanceID struct { // ID is the simple part of the InstanceID. ID string `json:"id" yaml:"id"` // Driver is the name of the StorageExecutor that created the InstanceID // as well as the name of the StorageDriver for which the InstanceID is // valid. Driver string `json:"driver"` // Fields is additional, driver specific data about the Instance ID. Fields map[string]string `json:"fields"` // contains filtered or unexported fields }
InstanceID identifies a host to a remote storage platform.
func (*InstanceID) DeleteMetadata ¶
func (i *InstanceID) DeleteMetadata()
DeleteMetadata deletes the metadata from the InstanceID.
func (*InstanceID) HasMetadata ¶ added in v0.3.0
func (i *InstanceID) HasMetadata() bool
HasMetadata returns a flag indicating whether or not the instance ID has any associated metadata.
func (*InstanceID) MarshalJSON ¶
func (i *InstanceID) MarshalJSON() ([]byte, error)
MarshalJSON marshals the InstanceID to JSON.
func (*InstanceID) MarshalMetadata ¶
func (i *InstanceID) MarshalMetadata(data interface{}) error
MarshalMetadata encodes the provided object to JSON and assigns the result to the InstanceID's metadata field.
func (*InstanceID) MarshalText ¶
func (i *InstanceID) MarshalText() ([]byte, error)
MarshalText marshals InstanceID to a text string that adheres to the format `DRIVER=ID[,METADATA]`. If metadata is present it is encoded as a base64 string.
func (*InstanceID) MarshalYAML ¶ added in v0.1.3
func (i *InstanceID) MarshalYAML() (interface{}, error)
MarshalYAML returns the object to marshal to the YAML representation of the InstanceID.
func (*InstanceID) String ¶
func (i *InstanceID) String() string
String returns the string representation of an InstanceID object.
func (*InstanceID) UnmarshalJSON ¶
func (i *InstanceID) UnmarshalJSON(data []byte) error
UnmarshalJSON marshals the InstanceID to JSON.
func (*InstanceID) UnmarshalMetadata ¶
func (i *InstanceID) UnmarshalMetadata(dest interface{}) error
UnmarshalMetadata decodes the InstanceID's metadata into the provided object.
func (*InstanceID) UnmarshalText ¶
func (i *InstanceID) UnmarshalText(value []byte) error
UnmarshalText unmarshals the data into a an InstanceID provided the data adheres to the format described in the MarshalText function.
type InstanceIDMap ¶
type InstanceIDMap map[string]*InstanceID
InstanceIDMap is a map of InstanceID objects.
type IntegrationDriver ¶
type IntegrationDriver interface { Driver // List a map that relates volume names to their mount points. List( ctx Context, opts Store) ([]VolumeMapping, error) // Inspect returns a specific volume as identified by the provided // volume name. Inspect( ctx Context, volumeName string, opts Store) (VolumeMapping, error) // 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( ctx Context, volumeID, volumeName string, opts *VolumeMountOpts) (string, *Volume, error) // Unmount will unmount the specified volume by volumeName or volumeID. Unmount( ctx Context, volumeID, volumeName string, opts Store) error // Path will return the mounted path of the volumeName or volumeID. Path( ctx Context, volumeID, volumeName string, opts Store) (string, error) // Create will create a new volume with the volumeName and opts. Create( ctx Context, volumeName string, opts *VolumeCreateOpts) (*Volume, error) // Remove will remove a volume of volumeName. Remove( ctx Context, volumeName string, opts Store) error // Attach will attach a volume based on volumeName to the instance of // instanceID. Attach( ctx Context, volumeName string, opts *VolumeAttachOpts) (string, error) // Detach will detach a volume based on volumeName to the instance of // instanceID. Detach( ctx Context, volumeName string, opts *VolumeDetachOpts) error }
IntegrationDriver is the interface implemented to integrate external storage consumers, such as Docker, with libStorage.
type IntegrationDriverManager ¶
type IntegrationDriverManager interface { IntegrationDriver // Driver returns the underlying driver. Driver() IntegrationDriver }
IntegrationDriverManager is the management wrapper for an IntegrationDriver.
type Level ¶
Level is a log level.
const ( // PanicLevel level, highest level of severity. Logs and then calls panic // with the message passed to Debug, Info, ... PanicLevel Level = Level(log.PanicLevel) + iota // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even // if the logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on // inside the application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose // logging. DebugLevel // TraceLevel level. An even more verbose levle of logging than DebugLevel. TraceLevel )
These are the different logging levels.
type LocalDevices ¶
type LocalDevices struct { // Driver is the name of the StorageExecutor that created the map // as well as the name of the StorageDriver for which the map is // valid. Driver string `json:"driver"` // DeviceMap is voluem to device mappings. DeviceMap map[string]string `json:"deviceMap,omitempty" yaml:"deviceMap,omitempty"` }
LocalDevices is a wrapper for a map of volume to device mappings.
func (*LocalDevices) MarshalJSON ¶
func (l *LocalDevices) MarshalJSON() ([]byte, error)
MarshalJSON marshals the InstanceID to JSON.
func (*LocalDevices) MarshalText ¶
func (l *LocalDevices) MarshalText() ([]byte, error)
MarshalText marshals LocalDevices to a text string that adheres to the format `DRIVER=VOLUMEID::DEVICEID[,VOLUMEID::DEVICEID,...]`.
func (*LocalDevices) MarshalYAML ¶ added in v0.1.3
func (l *LocalDevices) MarshalYAML() (interface{}, error)
MarshalYAML returns the object to marshal to the YAML representation of the LocalDevices.
func (*LocalDevices) String ¶
func (l *LocalDevices) String() string
String returns the string representation of a LocalDevices object.
func (*LocalDevices) UnmarshalJSON ¶
func (l *LocalDevices) UnmarshalJSON(data []byte) error
UnmarshalJSON marshals the InstanceID to JSON.
func (*LocalDevices) UnmarshalText ¶
func (l *LocalDevices) UnmarshalText(value []byte) error
UnmarshalText unmarshals the data into a an InstanceID provided the data adheres to the format described in the MarshalText function.
type LocalDevicesMap ¶
type LocalDevicesMap map[string]*LocalDevices
LocalDevicesMap is a map of LocalDevices objects.
type LocalDevicesOpts ¶
type LocalDevicesOpts struct { ScanType DeviceScanType Opts Store }
LocalDevicesOpts are options when getting a list of local devices.
type LogEntry ¶ added in v0.1.5
type LogEntry interface { FieldLogger }
LogEntry is collected data to be emitted as a log entry.
type Middleware ¶
type Middleware interface { // Name returns the name of the middlware. Name() string // Handler enables the chaining of middlware. Handler(handler APIFunc) APIFunc // Handle is for processing an incoming request. Handle( ctx Context, w http.ResponseWriter, r *http.Request, store Store) error }
Middleware is middleware for a route.
type MiddlewareFunc ¶
MiddlewareFunc is an adapter to allow the use of ordinary functions as API filters. Any function that has the appropriate signature can be register as a middleware.
type MountInfo ¶
type MountInfo struct { // ID is a unique identifier of the mount (may be reused after umount). ID int `json:"id" yaml:"id"` // Parent indicates the ID of the mount parent (or of self for the top of // the mount tree). Parent int `json:"parent"` // Major indicates one half of the device ID which identifies the device // class. Major int `json:"major"` // Minor indicates one half of the device ID which identifies a specific // instance of device. Minor int `json:"minor"` // Root of the mount within the filesystem. Root string `json:"root"` // MountPoint indicates the mount point relative to the process's root. MountPoint string `json:"mountPoint" yaml:"mountPoint"` // Opts represents mount-specific options. Opts string `json:"opts"` // Optional represents optional fields. Optional string `json:"optional"` // FSType indicates the type of filesystem, such as EXT3. FSType string `json:"fsType" yaml:"fsType"` // Source indicates filesystem specific information or "none". Source string `json:"source"` // VFSOpts represents per super block options. VFSOpts string `json:"vfsOpts" yaml:"vfsOpts"` // Fields are additional properties that can be defined for this type. Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"` }
MountInfo reveals information about a particular mounted filesystem. This struct is populated from the content in the /proc/<pid>/mountinfo file.
type NewClientDriver ¶
type NewClientDriver func() ClientDriver
NewClientDriver is a function that constructs a new ClientDriver.
type NewIntegrationDriver ¶
type NewIntegrationDriver func() IntegrationDriver
NewIntegrationDriver is a function that constructs a new IntegrationDriver.
type NewOSDriver ¶
type NewOSDriver func() OSDriver
NewOSDriver is a function that constructs a new OSDriver.
type NewRequestObjFunc ¶
type NewRequestObjFunc func() interface{}
NewRequestObjFunc is a function that creates a new instance of the type to which the request body is serialized.
type NewStorageDriver ¶
type NewStorageDriver func() StorageDriver
NewStorageDriver is a function that constructs a new StorageDriver.
type NewStorageExecutor ¶
type NewStorageExecutor func() StorageExecutor
NewStorageExecutor is a function that constructs a new StorageExecutors.
type NextDeviceInfo ¶
type NextDeviceInfo struct { // Ignore is a flag that indicates whether the client logic should invoke // the GetNextAvailableDeviceName function prior to submitting an // AttachVolume request to the server. Ignore bool `json:"ignore"` // Prefix is the first part of a device path's value after the "/dev/" // porition. For example, the prefix in "/dev/xvda" is "xvd". Prefix string `json:"prefix"` // Pattern is the regex to match the part of a device path after the prefix. Pattern string `json:"pattern"` }
NextDeviceInfo assists the libStorage client in determining the next available device name by providing the driver's device prefix and optional pattern.
For example, the Amazon Web Services (AWS) device prefix is "xvd" and its pattern is "[a-z]". These two values would be used to determine on an EC2 instance where "/dev/xvda" and "/dev/xvdb" are in use that the next available device name is "/dev/xvdc".
If the Ignore field is set to true then the client logic does not invoke the GetNextAvailableDeviceName function prior to submitting an AttachVolume request to the server.
type OSDriver ¶
type OSDriver interface { Driver // Mounts get a list of mount points for a local device. Mounts( ctx Context, deviceName, mountPoint string, opts Store) ([]*MountInfo, error) // Mount mounts a device to a specified path. Mount( ctx Context, deviceName, mountPoint string, opts *DeviceMountOpts) error // Unmount unmounts the underlying device from the specified path. Unmount( ctx Context, mountPoint string, opts Store) error // IsMounted checks whether a path is mounted or not IsMounted( ctx Context, mountPoint string, opts Store) (bool, error) // Format formats a device. Format( ctx Context, deviceName string, opts *DeviceFormatOpts) error }
OSDriver is the interface implemented by types that provide OS introspection and management.
type OSDriverManager ¶
type OSDriverManager interface { OSDriver // Driver returns the underlying driver. Driver() OSDriver }
OSDriverManager is the management wrapper for an OSDriver.
type ProvidesAPIClient ¶
type ProvidesAPIClient interface { // API provides the API client. API() APIClient }
ProvidesAPIClient is any type that provides the API client.
type ProvidesStorageExecutorCLI ¶
type ProvidesStorageExecutorCLI interface { // XCLI returns the StorageExecutorCLI. XCLI() StorageExecutorCLI }
ProvidesStorageExecutorCLI is a type that provides the StorageExecutorCLI.
type Route ¶
type Route interface { // Queries add query strings that must match for a route. Queries(queries ...string) Route // Middlewares adds middleware to the route. Middlewares(middlewares ...Middleware) Route // Name returns the name of the route. GetName() string // GetHandler returns the raw function to create the http handler. GetHandler() APIFunc // GetMethod returns the http method that the route responds to. GetMethod() string // GetPath returns the subpath where the route responds to. GetPath() string // GetQueries returns the query strings for which the route should respond. GetQueries() []string // GetMiddlewares returns a list of route-specific middleware. GetMiddlewares() []Middleware }
Route defines an individual API route in the server.
type Router ¶
type Router interface { // Routes returns all of the router's routes. Routes() []Route // Name returns the name of the router. Name() string // Init initializes the router. Init(config gofig.Config) }
Router defines an interface to specify a group of routes to add the the server.
type Server ¶
type Server interface { io.Closer // Name returns the name of the server. Name() string // Addrs returns the server's configured endpoint addresses. Addrs() []string }
Server is the interface for a libStorage server.
type ServiceInfo ¶
type ServiceInfo struct { // Name is the service's name. Name string `json:"name"` // Instance is the service's instance. Instance *Instance `json:"instance,omitempty" yaml:",omitempty"` // Driver is the name of the driver registered for the service. Driver *DriverInfo `json:"driver"` }
ServiceInfo is information about a service.
type ServiceSnapshotMap ¶
type ServiceSnapshotMap map[string]SnapshotMap
ServiceSnapshotMap is the response for listing snapshots for multiple services.
type ServiceVolumeMap ¶
ServiceVolumeMap is the response for listing volumes for multiple services.
type Services ¶
type Services interface { // Storage gets the storage service. Storage() StorageService // Tasks gets the task service. Tasks() TaskTrackingService }
Services is a service's container.
type ServicesMap ¶
type ServicesMap map[string]*ServiceInfo
ServicesMap is the response when getting one to many ServiceInfos.
type Snapshot ¶
type Snapshot struct { // A description of the snapshot. Description string `json:"description,omitempty" yaml:",omitempty"` // The name of the snapshot. Name string `json:"name,omitempty" yaml:",omitempty"` // A flag indicating whether or not the snapshot is encrypted. Encrypted bool `json:"encrypted,omitempty" yaml:"encrypted,omitempty"` // The snapshot's ID. ID string `json:"id" yaml:"id"` // The time (epoch) at which the request to create the snapshot was submitted. StartTime int64 `json:"startTime,omitempty" yaml:"startTime,omitempty"` // The status of the snapshot. Status string `json:"status,omitempty" yaml:",omitempty"` // The ID of the volume to which the snapshot belongs. VolumeID string `json:"volumeID,omitempty" yaml:"volumeID,omitempty"` // The size of the volume to which the snapshot belongs. VolumeSize int64 `json:"volumeSize,omitempty" yaml:"volumeSize,omitempty"` // Fields are additional properties that can be defined for this type. Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"` }
Snapshot provides information about a storage-layer snapshot.
type SnapshotCopyRequest ¶
type SnapshotCopyRequest struct { SnapshotName string `json:"snapshotName"` DestinationID string `json:"destinationID"` Opts map[string]interface{} `json:"opts,omitempty"` }
SnapshotCopyRequest is the JSON body for copying a snapshot.
type SnapshotMap ¶
SnapshotMap is the response for listing snapshots for a single service.
type SnapshotRemoveRequest ¶
type SnapshotRemoveRequest struct {
Opts map[string]interface{} `json:"opts,omitempty"`
}
SnapshotRemoveRequest is the JSON body for removing a snapshot.
type StorageDriver ¶
type StorageDriver interface { Driver // NextDeviceInfo returns the information about the driver's next available // device workflow. NextDeviceInfo( ctx Context) (*NextDeviceInfo, error) // Type returns the type of storage the driver provides. Type( ctx Context) (StorageType, error) // InstanceInspect returns an instance. InstanceInspect( ctx Context, opts Store) (*Instance, error) // Volumes returns all volumes or a filtered list of volumes. Volumes( ctx Context, opts *VolumesOpts) ([]*Volume, error) // VolumeInspect inspects a single volume. VolumeInspect( ctx Context, volumeID string, opts *VolumeInspectOpts) (*Volume, error) // VolumeCreate creates a new volume. VolumeCreate( ctx Context, name string, opts *VolumeCreateOpts) (*Volume, error) // VolumeCreateFromSnapshot creates a new volume from an existing snapshot. VolumeCreateFromSnapshot( ctx Context, snapshotID, volumeName string, opts *VolumeCreateOpts) (*Volume, error) // VolumeCopy copies an existing volume. VolumeCopy( ctx Context, volumeID, volumeName string, opts Store) (*Volume, error) // VolumeSnapshot snapshots a volume. VolumeSnapshot( ctx Context, volumeID, snapshotName string, opts Store) (*Snapshot, error) // VolumeRemove removes a volume. VolumeRemove( ctx Context, volumeID string, opts Store) error // VolumeAttach attaches a volume and provides a token clients can use // to validate that device has appeared locally. VolumeAttach( ctx Context, volumeID string, opts *VolumeAttachOpts) (*Volume, string, error) // VolumeDetach detaches a volume. VolumeDetach( ctx Context, volumeID string, opts *VolumeDetachOpts) (*Volume, error) // Snapshots returns all volumes or a filtered list of snapshots. Snapshots( ctx Context, opts Store) ([]*Snapshot, error) // SnapshotInspect inspects a single snapshot. SnapshotInspect( ctx Context, snapshotID string, opts Store) (*Snapshot, error) // SnapshotCopy copies an existing snapshot. SnapshotCopy( ctx Context, snapshotID, snapshotName, destinationID string, opts Store) (*Snapshot, error) // SnapshotRemove removes a snapshot. SnapshotRemove( ctx Context, snapshotID string, opts Store) error }
StorageDriver is a libStorage driver used by the routes to implement the backend functionality.
Functions that inspect a resource or send an operation to a resource should always return ErrResourceNotFound if the acted upon resource cannot be found.
type StorageDriverManager ¶
type StorageDriverManager interface { StorageDriver // Driver returns the underlying driver. Driver() StorageDriver }
StorageDriverManager is the management wrapper for a StorageDriver.
type StorageDriverWithLogin ¶ added in v0.3.0
type StorageDriverWithLogin interface { StorageDriver // Login creates a new connection to the storage platform for the provided // context. Login( ctx Context) (interface{}, error) }
StorageDriverWithLogin is a StorageDriver with a Login function.
type StorageExecutor ¶
type StorageExecutor interface { Driver StorageExecutorFunctions }
StorageExecutor is the part of a storage driver that is downloaded at runtime by the libStorage client.
type StorageExecutorCLI ¶
type StorageExecutorCLI interface { StorageExecutorWithSupported // WaitForDevice blocks until the provided attach token appears in the // map returned from LocalDevices or until the timeout expires, whichever // occurs first. // // The return value is a boolean flag indicating whether or not a match was // discovered as well as the result of the last LocalDevices call before a // match is discovered or the timeout expires. WaitForDevice( ctx Context, opts *WaitForDeviceOpts) (bool, *LocalDevices, error) }
StorageExecutorCLI provides a way to interact with the CLI tool built with the driver implementations of the StorageExecutor interface.
type StorageExecutorFunctions ¶
type StorageExecutorFunctions interface { // InstanceID returns the local system's InstanceID. InstanceID( ctx Context, opts Store) (*InstanceID, error) // NextDevice returns the next available device. NextDevice( ctx Context, opts Store) (string, error) // LocalDevices returns a map of the system's local devices. LocalDevices( ctx Context, opts *LocalDevicesOpts) (*LocalDevices, error) }
StorageExecutorFunctions is the collection of functions that are required of a StorageExecutor.
type StorageExecutorWithSupported ¶ added in v0.3.0
type StorageExecutorWithSupported interface { StorageExecutorFunctions // Supported returns a flag indicating whether or not the platform // implementing the executor is valid for the host on which the executor // resides. Supported( ctx Context, opts Store) (bool, error) }
StorageExecutorWithSupported is an interface that executor implementations may use by defining the function "Supported(Context, Store) (bool, error)". This function indicates whether a storage platform is valid when executing the executor binary on a given client.
type StorageService ¶
type StorageService interface { Service // Driver returns the service's StorageDriver. Driver() StorageDriver // TaskExecute enqueues a task for execution. TaskExecute( ctx Context, run StorageTaskRunFunc, schema []byte) *Task }
StorageService is a service that provides the interaction with StorageDrivers.
type StorageTaskRunFunc ¶
type StorageTaskRunFunc func( ctx Context, service StorageService) (interface{}, error)
StorageTaskRunFunc is a function responsible for a storage-service task's execution.
type StorageType ¶
type StorageType string
StorageType is the type of storage a driver provides.
const ( // Block is block storage. Block StorageType = "block" // NAS is network attached storage. NAS StorageType = "nas" // Object is object-backed storage. Object StorageType = "object" )
type Store ¶
type Store interface { // Map returns the contents of the store as a map[string]interface{}. Map() map[string]interface{} // Keys returns a list of all the keys in the store. Keys() []string // IsSet returns true if a key exists. IsSet(k string) bool // Get returns a value for the key; a nil value if the key does not exist. Get(k string) interface{} // GetString returns a string value for a key; an empty string if the key // does not exist. GetString(k string) string // GetStringPtr returns a pointer to a string value for a key; nil if // the key does not exist. GetStringPtr(k string) *string // GetBool returns a boolean value for the key; false if the key does not // exist. GetBool(k string) bool // GetBoolPtr returns a pointer to a boolean value for the key; nil if the // key does not exist. GetBoolPtr(k string) *bool // GetInt return an int value for the key; 0 if the key does not exist. GetInt(k string) int // GetInt return a pointer to an int value for the key; nil if the key does // not exist. GetIntPtr(k string) *int // GetInt64 return an int64 value for the key; 0 if the key does not exist. GetInt64(k string) int64 // GetInt64Ptr return a pointer to an int64 value for the key; nil if the // key does not exist. GetInt64Ptr(k string) *int64 // GetIntSlice returns an int slice value for a key; a nil value if // the key does not exist. GetIntSlice(k string) []int // GetStringSlice returns a string slice value for a key; a nil value if // the key does not exist. GetStringSlice(k string) []string // GetBoolSlice returns a bool slice value for a key; a nil value if // the key does not exist. GetBoolSlice(k string) []bool // GetInstanceID returns an instance ID for a key; a nil value if the key // does not exist. GetInstanceID(k string) *InstanceID // GetMap returns a map value for a key; a nil value if the key does not // exist. GetMap(k string) map[string]interface{} // GetStore returns a Store value for a key; a nil value if the key does // not exist. GetStore(k string) Store // Set sets a key/value in the store. Set(k string, v interface{}) // Deletes a key/value from the store. If the value exists in the map it // is returned. Delete(k string) interface{} }
Store is a key/value store with case-insensitive keys.
type Task ¶
type Task struct { // ID is the task's ID. ID int `json:"id" yaml:"id"` // User is the name of the user that created the task. User string `json:"user,omitempty" yaml:",omitempty"` // CompleteTime is the time stamp when the task was completed // (whether success or failure). CompleteTime int64 `json:"completeTime,omitempty" yaml:"completeTime,omitempty"` // QueueTime is the time stamp when the task was created. QueueTime int64 `json:"queueTime" yaml:"queueTime"` // StartTime is the time stamp when the task started running. StartTime int64 `json:"startTime,omitempty" yaml:"startTime,omitempty"` // State is the current state of the task. State TaskState `json:"state"` // Result holds the result of the task. Result interface{} `json:"result,omitempty" yaml:",omitempty"` // Error contains the error if the task was unsuccessful. Error error `json:"error,omitempty" yaml:",omitempty"` }
Task is a representation of an asynchronous, long-running task.
type TaskExecutionService ¶
type TaskExecutionService interface { Service // TaskExecute enqueues a task for execution. TaskExecute( ctx Context, run TaskRunFunc, schema []byte) *Task }
TaskExecutionService is a service for executing tasks.
type TaskRunFunc ¶
TaskRunFunc is a function responsible for a task's execution.
type TaskTrackingService ¶
type TaskTrackingService interface { Service // Tasks returns a channel on which all tasks tracked via TrackTasks are // received. Tasks() <-chan *Task // TaskTrack creates a new, trackable task. TaskTrack(ctx Context) *Task // TaskExecute enqueues a task for execution. TaskExecute( ctx Context, run TaskRunFunc, schema []byte) *Task // TaskInspect returns the task with the specified ID. TaskInspect(taskID int) *Task // TaskWait blocks until the specified task completes. TaskWait(taskID int) <-chan int // TaskWaitAll blocks until all the specified tasks complete. TaskWaitAll(taskIDs ...int) <-chan int // TaskWaitC returns a channel that is closed when the specified task // completes. TaskWaitC(taskID int) <-chan int // TaskWaitAll returns a channel that is closed when the specified task // completes. TaskWaitAllC(taskIDs ...int) <-chan int }
TaskTrackingService a service for tracking tasks.
type Transaction ¶
type Transaction struct { // ID is the transaction's ID. ID *UUID `json:"id" yaml:"id"` // Created is the UTC timestampe at which the transaction was created. Created TxTimestamp `json:"created"` }
Transaction contains transaction information.
func NewTransaction ¶
func NewTransaction() (*Transaction, error)
NewTransaction returns a new transaction.
func (*Transaction) ContextLoggerFields ¶
func (t *Transaction) ContextLoggerFields() map[string]interface{}
ContextLoggerFields indicate to the context logger what data to log.
func (*Transaction) MarshalText ¶
func (t *Transaction) MarshalText() ([]byte, error)
MarshalText marshals the Transaction to a string.
func (*Transaction) String ¶
func (t *Transaction) String() string
String returns the string representation of the transaction.
func (*Transaction) UnmarshalText ¶
func (t *Transaction) UnmarshalText(text []byte) error
UnmarshalText unmarshals the Transaction from a string.
type TxTimestamp ¶
TxTimestamp is a transaction's timestamp.
func (TxTimestamp) MarshalText ¶
func (t TxTimestamp) MarshalText() ([]byte, error)
MarshalText marshals the TxTimestamp to a string.
func (TxTimestamp) String ¶
func (t TxTimestamp) String() string
String returns the timestamp's epoch.
func (*TxTimestamp) UnmarshalText ¶
func (t *TxTimestamp) UnmarshalText(text []byte) error
UnmarshalText unmarshals the timestamp from a string to a TxTimestamp.
type UUID ¶
type UUID [16]byte
UUID is a UUID.
This was totally stolen from https://github.com/nu7hatch/gouuid/blob/master/uuid.go, and all credit goes to that author. It was included like this in order to reduce external dependencies.
func MustNewUUID ¶
func MustNewUUID() *UUID
MustNewUUID is like NewUUID but panics if it encounters an error when creating a new UUID.
func (*UUID) MarshalText ¶
MarshalText marshals the UUID to a string.
func (*UUID) UnmarshalText ¶
UnmarshalText unmarshals the UUID from a hex string to a UUID instance. This function accepts UUID string in following formats:
uuid.ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8") uuid.ParseHex("{6ba7b814-9dad-11d1-80b4-00c04fd430c8}") uuid.ParseHex("urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8")
type VersionInfo ¶ added in v0.1.1
type VersionInfo struct { // SemVer is the semantic version string SemVer string // ShaLong is the commit hash from which this package was built ShaLong string // BuildTimestamp is the UTC timestamp for when this package was built. BuildTimestamp time.Time // Branch is the branch name from which this package was built Branch string // Arch is the OS-Arch string of the system on which this package is // supported. Arch string }
VersionInfo provides information about the libStorage version.
func (*VersionInfo) MarshalJSON ¶ added in v0.1.1
func (v *VersionInfo) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON representation of the version.
func (*VersionInfo) MarshalYAML ¶ added in v0.1.3
func (v *VersionInfo) MarshalYAML() (interface{}, error)
MarshalYAML returns the object to marshal to the YAML representation of the version.
func (*VersionInfo) String ¶ added in v0.1.1
func (v *VersionInfo) String() string
String returns the version information as a string.
type Volume ¶
type Volume struct { // The volume's attachments. Attachments []*VolumeAttachment `json:"attachments,omitempty" yaml:",omitempty"` // The availability zone for which the volume is available. AvailabilityZone string `json:"availabilityZone,omitempty" yaml:"availabilityZone,omitempty"` // A flag indicating whether or not the volume is encrypted. Encrypted bool `json:"encrypted,omitempty" yaml:"encrypted,omitempty"` // The volume IOPs. IOPS int64 `json:"iops,omitempty" yaml:"iops,omitempty"` // The name of the volume. Name string `json:"name"` // NetworkName is the name the device is known by in order to discover // locally. NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"` // The size of the volume. Size int64 `json:"size,omitempty" yaml:",omitempty"` // The volume status. Status string `json:"status,omitempty" yaml:",omitempty"` // ID is a piece of information that uniquely identifies the volume on // the storage platform to which the volume belongs. A volume ID is not // guaranteed to be unique across multiple, configured services. ID string `json:"id" yaml:"id"` // The volume type. Type string `json:"type"` // Fields are additional properties that can be defined for this type. Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"` }
Volume provides information about a storage volume.
func (*Volume) MountPoint ¶
MountPoint returns the volume's mount point, if one is present.
func (*Volume) VolumeName ¶
VolumeName returns the volume's name.
type VolumeAttachOpts ¶
VolumeAttachOpts are options for attaching a volume.
type VolumeAttachRequest ¶
type VolumeAttachRequest struct { Force bool `json:"force,omitempty"` NextDeviceName *string `json:"nextDeviceName,omitempty"` Opts map[string]interface{} `json:"opts,omitempty"` }
VolumeAttachRequest is the JSON body for attaching a volume to an instance.
type VolumeAttachResponse ¶
type VolumeAttachResponse struct { Volume *Volume `json:"volume"` AttachToken string `json:"attachToken"` }
VolumeAttachResponse is the JSON response for attaching a volume to an instance.
type VolumeAttachment ¶
type VolumeAttachment struct { // The name of the device on which the volume to which the object is // attached is mounted. DeviceName string `json:"deviceName" yaml:"deviceName,omitempty"` // MountPoint is the mount point for the volume. This field is set when a // volume is retrieved via an integration driver. MountPoint string `json:"mountPoint,omitempty" yaml:"mountPoint,omitempty"` // The ID of the instance on which the volume to which the attachment // belongs is mounted. InstanceID *InstanceID `json:"instanceID" yaml:"instanceID,omitempty"` // The status of the attachment. Status string `json:"status" yaml:",omitempty"` // The ID of the volume to which the attachment belongs. VolumeID string `json:"volumeID" yaml:"volumeID,omitempty"` // Fields are additional properties that can be defined for this type. Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"` }
VolumeAttachment provides information about an object attached to a storage volume.
type VolumeCopyRequest ¶
type VolumeCopyRequest struct { VolumeName string `json:"volumeName"` Opts map[string]interface{} `json:"opts,omitempty"` }
VolumeCopyRequest is the JSON body for copying a volume.
type VolumeCreateOpts ¶
type VolumeCreateOpts struct { AvailabilityZone *string IOPS *int64 Size *int64 Type *string Encrypted *bool Opts Store }
VolumeCreateOpts are options when creating a new volume.
type VolumeCreateRequest ¶
type VolumeCreateRequest struct { Name string `json:"name"` AvailabilityZone *string `json:"availabilityZone,omitempty"` Encrypted *bool `json:"encrypted,omitempty"` IOPS *int64 `json:"iops,omitempty"` Size *int64 `json:"size,omitempty"` Type *string `json:"type,omitempty"` Opts map[string]interface{} `json:"opts,omitempty"` }
VolumeCreateRequest is the JSON body for creating a new volume.
type VolumeDetachOpts ¶
VolumeDetachOpts are options for detaching a volume.
type VolumeDetachRequest ¶
type VolumeDetachRequest struct { Force bool `json:"force,omitempty"` Opts map[string]interface{} `json:"opts,omitempty"` }
VolumeDetachRequest is the JSON body for detaching a volume from an instance.
type VolumeDevice ¶
type VolumeDevice struct { // The name of the device. Name string `json:"name"` // The ID of the instance to which the device is connected. InstanceID *InstanceID `json:"instanceID,omitempty" yaml:"instanceID,omitempty"` // The name of the network on which the device resides. NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"` // The name of the provider that owns the block device. ProviderName string `json:"providerName,omitempty" yaml:"providerName,omitempty"` // The region from which the device originates. Region string `json:"region,omitempty" yaml:",omitempty"` // The device status. Status string `json:"status"` // The ID of the volume for which the device is mounted. VolumeID string `json:"volumeID" yaml:"volumeID"` // Fields are additional properties that can be defined for this type. Fields map[string]string `json:"fields,omitempty" yaml:",omitempty"` }
VolumeDevice provides information about a volume's backing storage device. This might be a block device, NAS device, object device, etc.
type VolumeInspectOpts ¶
VolumeInspectOpts are options when inspecting a volume.
type VolumeMapping ¶
type VolumeMapping interface { // VolumeName returns the volume's name. VolumeName() string // MountPoint returns the volume's mount point. MountPoint() string // Status returns the volume's details for an inspect. Status() map[string]interface{} }
VolumeMapping is a volume's name and the path to which it is mounted.
type VolumeMountOpts ¶
VolumeMountOpts are options for mounting a volume.
type VolumeSnapshotRequest ¶
type VolumeSnapshotRequest struct { SnapshotName string `json:"snapshotName"` Opts map[string]interface{} `json:"opts,omitempty"` }
VolumeSnapshotRequest is the JSON body for snapshotting a volume.
type VolumesOpts ¶
VolumesOpts are options when inspecting a volume.
type WaitForDeviceOpts ¶
type WaitForDeviceOpts struct { LocalDevicesOpts // Token is the value returned by a remote VolumeAttach call that the // client can use to block until a specific device has appeared in the // local devices list. Token string // Timeout is the maximum duration for which to wait for a device to // appear in the local devices list. Timeout time.Duration }
WaitForDeviceOpts are options when waiting on specific local device to appear.
Source Files ¶
- types.go
- types_clients.go
- types_config.go
- types_config_compat.go
- types_config_integration.go
- types_context.go
- types_drivers.go
- types_drivers_client.go
- types_drivers_executor.go
- types_drivers_integration.go
- types_drivers_os.go
- types_drivers_storage.go
- types_errors.go
- types_filter.go
- types_http_headers.go
- types_http_middleware.go
- types_http_requests.go
- types_http_responses.go
- types_http_routes.go
- types_instanceid.go
- types_localdevices.go
- types_logger.go
- types_model.go
- types_paths.go
- types_server.go
- types_services.go
- types_store.go
- types_tx.go
- types_uuid.go
- types_version.go