api

package
v0.0.0-...-585c797 Latest Latest
Warning

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

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

README

package api

Package api defines the payload structures used between the client and the apiserver for the volumes and cluster packages.

Documentation

Index

Constants

View Source
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)
)
View Source
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")
)
View Source
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")
)
View Source
const BadVolumeID = VolumeID("")

BadVolumeID invalid volume ID, usually accompanied by an error.

View Source
const Version = "v1"

Version API version

VolumeStateAny a filter that selects all volumes

Variables

This section is empty.

Functions

This section is empty.

Types

type Alerts

type Alerts struct {
}

Alerts

type Cluster

type Cluster struct {
	Status Status
	Id     string
	Nodes  []Node
}

Cluster represents the state of the cluster.

type ClusterActionParam

type ClusterActionParam int

VolumeActionParam desired action on volume

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 CreateOptions

type CreateOptions struct {
	// FailIfExists fail create request if a volume with matching Locator
	// already exists.
	FailIfExists bool
	// CreateFromSnap will create a volume with specified SnapID
	CreateFromSnap VolumeID
	// CreateFromSource will seed the volume from the specified URI. Any
	// additional config for the source comes from the labels in the spec.
	CreateFromSource string
}

CreateOptions are passed in with a CreateRequest

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 Labels

type Labels map[string]string

Labels a name-value map

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 []dockerclient.Container
}

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 OptionKey

type OptionKey string

OptionKey specifies a set of recognized query params

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 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 Status

type Status int
const (
	StatusInit Status = 1 << iota
	StatusOk
	StatusOffline
	StatusError
)

type Volume

type Volume struct {
	// ID Self referential VolumeID
	ID VolumeID
	// Parent ID if this was a snap
	Parent VolumeID
	// 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 VolumeCos

type VolumeCos int

VolumeCos a number representing class of servcie.

type VolumeCreateRequest

type VolumeCreateRequest struct {
	// Locator user specified volume name and labels.
	Locator VolumeLocator `json:"locator"`
	// Options to create volume
	Options *CreateOptions `json:"options,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 VolumeID

type VolumeID string

VolumeID driver specific system wide unique volume identifier.

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 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 {
	// Format volume
	Format VolumeActionParam `json:"format"`
	// 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

type VolumeStateResponse

type VolumeStateResponse struct {
	// VolumeStateRequest the current state of the volume
	VolumeStateAction
	VolumeResponse
}

VolumeStateResponse is the body of the REST response

type VolumeStatus

type VolumeStatus string

VolumeStatus a health status.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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