Documentation
¶
Overview ¶
Package api defines the payload structures used between the client and the apiserver for the volumes and cluster packages.
Index ¶
- Constants
- type Alerts
- type Cluster
- type ClusterActionParam
- type ClusterResponse
- type ClusterStateAction
- type ClusterStateResponse
- type DriverType
- type Filesystem
- type GraphDriverChanges
- type Labels
- type MachineID
- type Node
- type OptionKey
- type SnapCreateRequest
- type SnapCreateResponse
- type Source
- type Stats
- type Status
- type Volume
- type VolumeActionParam
- type VolumeCos
- type VolumeCreateRequest
- type VolumeCreateResponse
- type VolumeID
- type VolumeInfo
- type VolumeLocator
- type VolumeResponse
- type VolumeSetRequest
- type VolumeSetResponse
- type VolumeSpec
- type VolumeState
- type VolumeStateAction
- type VolumeStatus
Constants ¶
const ( File = 1 << iota Block Object Clustered Graph )
const ( // VolumeCosNone minmum level of CoS VolumeCosNone = VolumeCos(0) // VolumeCosMedium in-between level of Cos VolumeCosMedium = VolumeCos(5) // VolumeCosMax maximum level of CoS VolumeCosMax = VolumeCos(9) )
const ( // NotPresent This volume is not present. NotPresent = VolumeStatus("NotPresent") // Up status healthy Up = VolumeStatus("Up") // Down status failure. Down = VolumeStatus("Down") // Degraded status up but with degraded performance. In a RAID group, this may indicate a problem with one or more drives Degraded = VolumeStatus("Degraded") )
const ( SpecEphemeral = "ephemeral" SpecSize = "size" SpecFilesystem = "format" SpecBlockSize = "blocksize" SpecHaLevel = "ha_level" SpecCos = "cos" SpecSnapshotInterval = "snapshot_interval" SpecDedupe = "dedupe" )
Strings for VolumeSpec
const ( // OptName query parameter used to lookup volume by name OptName = OptionKey("Name") // OptVolumeID query parameter used to lookup volume by ID. OptVolumeID = OptionKey("VolumeID") // OptLabel query parameter used to lookup volume by set of labels. OptLabel = OptionKey("Label") // OptConfigLabel query parameter used to lookup volume by set of labels. OptConfigLabel = OptionKey("ConfigLabel") )
const BadVolumeID = VolumeID("")
BadVolumeID invalid volume ID, usually accompanied by an error.
const Version = "v1"
Version API version
const VolumeStateAny = VolumePending | VolumeAvailable | VolumeAttached | VolumeDetaching | VolumeDetached | VolumeError | VolumeDeleted
VolumeStateAny a filter that selects all volumes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterResponse ¶
type ClusterResponse struct {
// Error is "" on success or contains the error message on failure.
Error string `json:"error"`
}
VolumeResponse is embedded in all REST responses.
type ClusterStateAction ¶
type ClusterStateAction struct {
// Remove a node or a set of nodes
Remove ClusterActionParam `json:"remove"`
// Shutdown a node or a set of nodes
Shutdown ClusterActionParam `json:"shutdown"`
}
ClusterStateAction is the body of the REST request to specify desired actions
type ClusterStateResponse ¶
type ClusterStateResponse struct {
// VolumeStateRequest the current state of the volume
ClusterStateAction
ClusterResponse
}
ClusterStateResponse is the body of the REST response
type DriverType ¶
type DriverType int
type Filesystem ¶
type Filesystem string
Filesystem supported filesystems
const ( FsNone Filesystem = "none" FsExt4 Filesystem = "ext4" FsXfs Filesystem = "xfs" FsZfs Filesystem = "zfs" FsNfs Filesystem = "nfs" )
type GraphDriverChanges ¶
GraphDriverChanges represent a list of changes between the filesystem layers specified by the ID and Parent. // Parent may be an empty string, in which case there is no parent. Where the Path is the filesystem path within the layered filesystem that is changed and Kind is an integer specifying the type of change that occurred: 0 - Modified 1 - Added 2 - Deleted
type MachineID ¶
type MachineID string
MachineID is a node instance identifier for clustered systems.
const MachineNone MachineID = ""
type Node ¶
type Node struct {
Id string
Cpu float64 // percentage.
Memory float64 // percentage.
Luns map[string]systemutils.Lun
Avgload int
Ip string
Timestamp time.Time
Status Status
Containers []docker.APIContainers
NodeData map[string]interface{}
GenNumber uint64
}
Node describes the state of a node. It includes the current physical state (CPU, memory, storage, network usage) as well as the containers running on the system.
type SnapCreateRequest ¶
type SnapCreateRequest struct {
ID VolumeID `json:"id"`
Locator VolumeLocator `json:"locator"`
Readonly bool `json:"readonly"`
}
SnapCreateRequest request body to create a snap.
type SnapCreateResponse ¶
type SnapCreateResponse struct {
VolumeCreateResponse
}
SnapCreateResponse response body to SnapCreateRequest
type Source ¶
type Source struct {
// Parent if specified will create a clone of Parent.
Parent VolumeID
// Seed will seed the volume from the specified URI. Any
// additional config for the source comes from the labels in the spec.
Seed string
}
CreateOptions are passed in with a CreateRequest
type Stats ¶
type Stats struct {
// Reads completed successfully.
Reads int64
// ReadMs time spent in reads in ms.
ReadMs int64
// ReadBytes
ReadBytes int64
// Writes completed successfully.
Writes int64
// WriteBytes
WriteBytes int64
// WriteMs time spent in writes in ms.
WriteMs int64
// IOProgress I/Os curently in progress.
IOProgress int64
// IOMs time spent doing I/Os ms.
IOMs int64
}
Alerts
type Volume ¶
type Volume struct {
// ID Self referential VolumeID
ID VolumeID
// Source
Source *Source
// Readonly
Readonly bool
// Locator User specified locator
Locator VolumeLocator
// Ctime Volume creation time
Ctime time.Time
// Spec User specified VolumeSpec
Spec *VolumeSpec
// Usage Volume usage
Usage uint64
// LastScan time when an integrity check for run
LastScan time.Time
// Format Filesystem type if any
Format Filesystem
// Status see VolumeStatus
Status VolumeStatus
// State see VolumeState
State VolumeState
// AttachedOn - Node on which this volume is attached.
AttachedOn MachineID
// DevicePath
DevicePath string
// AttachPath
AttachPath string
// ReplicaSet Set of nodes no which this Volume is erasure coded - for clustered storage arrays
ReplicaSet []MachineID
// Error Last recorded error
Error string
}
Volume represents a live, created volume.
type VolumeActionParam ¶
type VolumeActionParam int
VolumeActionParam desired action on volume
const ( // ParamIgnore user should ignore the value of the parameter. ParamIgnore VolumeActionParam = iota // ParamOff maps to the boolean value false. ParamOff // ParamOn maps to the boolean value true. ParamOn )
type VolumeCreateRequest ¶
type VolumeCreateRequest struct {
// Locator user specified volume name and labels.
Locator VolumeLocator `json:"locator"`
// Source to create volume
Source *Source `json:"source,omitempty"`
// Spec is the storage spec for the volume
Spec *VolumeSpec `json:"spec,omitempty"`
}
VolumeCreateRequest is the body of create REST request
type VolumeCreateResponse ¶
type VolumeCreateResponse struct {
// ID of the newly created volume
ID VolumeID `json:"id"`
VolumeResponse
}
VolumeCreateResponse is the body of create REST response
type VolumeInfo ¶
type VolumeInfo struct {
Path string
Storage *VolumeSpec
VolumeID VolumeID
}
type VolumeLocator ¶
type VolumeLocator struct {
// Name user friendly identifier
Name string
// VolumeLabels set of name-value pairs that acts as search filters.
VolumeLabels Labels
}
VolumeLocator is a structure that is attached to a volume and is used to carry opaque metadata.
type VolumeResponse ¶
type VolumeResponse struct {
// Error is "" on success or contains the error message on failure.
Error string `json:"error"`
}
VolumeResponse is embedded in all REST responses.
func ResponseStatusNew ¶
func ResponseStatusNew(err error) VolumeResponse
ResponseStatusNew create VolumeResponse from error
type VolumeSetRequest ¶
type VolumeSetRequest struct {
// Locator user specified volume name and labels.
Locator *VolumeLocator `json:"locator,omitempty"`
// Spec is the storage spec for the volume
Spec *VolumeSpec `json:"spec,omitempty"`
// Action state modification on this volume.
Action *VolumeStateAction `json:"action,omitempty"`
}
type VolumeSetResponse ¶
type VolumeSetResponse struct {
// Volume updated volume
Volume
// VolumeResponse error status
VolumeResponse
}
VolumeSetResponse is the body of the REST response
type VolumeSpec ¶
type VolumeSpec struct {
// Ephemeral storage
Ephemeral bool
// Thin provisioned volume size in bytes
Size uint64
// Format disk with this FileSystem
Format Filesystem
// BlockSize for file system
BlockSize int
// HA Level specifies the number of nodes that are
// allowed to fail, and yet data is availabel.
// A value of 0 implies that data is not erasure coded,
// a failure of a node will lead to data loss.
HALevel int
// This disk's CoS
Cos VolumeCos
// Perform dedupe on this disk
Dedupe bool
// SnapshotInterval in minutes, set to 0 to disable Snapshots
SnapshotInterval int
// Volume configuration labels
ConfigLabels Labels
}
VolumeSpec has the properties needed to create a volume.
type VolumeState ¶
type VolumeState int
VolumeState is one of the below enumerations and reflects the state of a volume.
const ( // VolumePending volume is transitioning to new state VolumePending VolumeState = 1 << iota // VolumeAvailable volume is ready to be assigned to a container VolumeAvailable // VolumeAttached is attached to container VolumeAttached // VolumeDetached is detached but associated with a container. VolumeDetached // VolumeDetaching is detach is in progress. VolumeDetaching // VolumeError is in Error State VolumeError // VolumeDeleted is deleted, it will remain in this state while resources are // asynchronously reclaimed. VolumeDeleted )
type VolumeStateAction ¶
type VolumeStateAction struct {
// Attach or Detach volume
Attach VolumeActionParam `json:"attach"`
// Mount or unmount volume
Mount VolumeActionParam `json:"mount"`
// MountPath
MountPath string `json:"mount_path"`
// DevicePath returned in Attach
DevicePath string `json:"device_path"`
}
VolumeStateAction is the body of the REST request to specify desired actions