Documentation
¶
Index ¶
- Constants
- Variables
- type BackendDrivers
- type Client
- func (c *Client) CreateVolume(rc Request) (*Volume, error)
- func (c *Client) DeletePolicy(name string) error
- func (c *Client) DumpTarball() (string, error)
- func (tlc *Client) GetGlobal() (*Global, error)
- func (c *Client) GetPolicy(name string) (*Policy, error)
- func (c *Client) GetUse(ut UseLocker, vc *Volume) error
- func (c *Client) GetVolume(policy, name string) (*Volume, error)
- func (c *Client) GetVolumeRuntime(policy, name string) (RuntimeOptions, error)
- func (c *Client) ListAllVolumes() ([]string, error)
- func (c *Client) ListPolicies() ([]Policy, error)
- func (c *Client) ListUses(typ string) ([]string, error)
- func (c *Client) ListVolumes(policy string) (map[string]*Volume, error)
- func (tlc *Client) PublishGlobal(g *Global) error
- func (c *Client) PublishPolicy(name string, cfg *Policy) error
- func (c *Client) PublishUse(ut UseLocker) error
- func (c *Client) PublishUseWithTTL(ut UseLocker, ttl time.Duration, exist client.PrevExistType) error
- func (c *Client) PublishVolume(vc *Volume) error
- func (c *Client) PublishVolumeRuntime(vo *Volume, ro RuntimeOptions) error
- func (c *Client) RemoveTakeSnapshot(name string) error
- func (c *Client) RemoveUse(ut UseLocker, force bool) error
- func (c *Client) RemoveVolume(policy, name string) error
- func (c *Client) TakeSnapshot(name string) error
- func (tlc *Client) WatchGlobal(activity chan *watch.Watch)
- func (c *Client) WatchSnapshotSignal(activity chan *watch.Watch)
- func (c *Client) WatchVolumeRuntimes(activity chan *watch.Watch)
- type CreateOptions
- type Global
- type Policy
- type RateLimitConfig
- type Request
- type RuntimeOptions
- type SnapshotConfig
- type UseLocker
- type UseMount
- type UseSnapshot
- type Volume
Constants ¶
const ( // DefaultGlobalTTL is the TTL used when no TTL exists. DefaultGlobalTTL = 30 * time.Second // DefaultTimeout is the standard command timeout when none is provided. DefaultTimeout = 10 * time.Minute )
Variables ¶
var ( // UseTypeMount is the string type of mount use locks UseTypeMount = "mount" // UseTypeSnapshot is the string type of snapshot use locks UseTypeSnapshot = "snapshot" )
Functions ¶
This section is empty.
Types ¶
type BackendDrivers ¶
type BackendDrivers struct {
CRUD string `json:"crud"`
Mount string `json:"mount"`
Snapshot string `json:"snapshot"`
}
BackendDrivers is a struct containing all the drivers used under this policy
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the top-level struct for communicating with the intent store.
func NewClient ¶
NewClient creates a Client struct which can drive communication with the configuration store.
func (*Client) CreateVolume ¶
CreateVolume sets the appropriate config metadata for a volume creation operation, and returns the Volume that was copied in.
func (*Client) DeletePolicy ¶
DeletePolicy removes a policy from the configuration store.
func (*Client) DumpTarball ¶
DumpTarball dumps all the keys under the current etcd prefix into a gzip'd tarball'd directory-based representation of the namespace.
func (*Client) GetVolumeRuntime ¶
func (c *Client) GetVolumeRuntime(policy, name string) (RuntimeOptions, error)
GetVolumeRuntime retrieves only the runtime parameters for the volume.
func (*Client) ListAllVolumes ¶
ListAllVolumes returns an array with all the named policies and volumes the volmaster knows about. Volumes have syntax: policy/volumeName which will be reflected in the returned string.
func (*Client) ListPolicies ¶
ListPolicies provides an array of strings corresponding to the name of each policy.
func (*Client) ListVolumes ¶
ListVolumes returns a map of volume name -> Volume.
func (*Client) PublishGlobal ¶
PublishGlobal publishes the global configuration.
func (*Client) PublishPolicy ¶
PublishPolicy publishes policy intent to the configuration store.
func (*Client) PublishUse ¶
PublishUse pushes the use to etcd.
func (*Client) PublishUseWithTTL ¶
func (c *Client) PublishUseWithTTL(ut UseLocker, ttl time.Duration, exist client.PrevExistType) error
PublishUseWithTTL pushes the use to etcd, with a TTL that expires the record if it has not been updated within that time.
func (*Client) PublishVolume ¶
PublishVolume writes a volume to etcd.
func (*Client) PublishVolumeRuntime ¶
func (c *Client) PublishVolumeRuntime(vo *Volume, ro RuntimeOptions) error
PublishVolumeRuntime publishes the runtime parameters for each volume.
func (*Client) RemoveTakeSnapshot ¶
RemoveTakeSnapshot removes a reference to a taken snapshot, intended to be used by volsupervisor
func (*Client) RemoveUse ¶
RemoveUse will remove a user from etcd. Does not fail if the user does not exist.
func (*Client) RemoveVolume ¶
RemoveVolume removes a volume from configuration.
func (*Client) TakeSnapshot ¶
TakeSnapshot immediately takes a snapshot by signalling the volsupervisor through etcd.
func (*Client) WatchGlobal ¶
WatchGlobal watches a global and updates it as soon as the config changes.
func (*Client) WatchSnapshotSignal ¶
WatchSnapshotSignal watches for a signal to be provided to /volplugin/snapshots via writing an empty file to the policy/volume name.
func (*Client) WatchVolumeRuntimes ¶
WatchVolumeRuntimes watches the runtime portions of the volume and yields back any information received through the activity channel.
type CreateOptions ¶
type CreateOptions struct {
Size string `json:"size" merge:"size"`
FileSystem string `json:"filesystem" merge:"filesystem"`
}
CreateOptions are the set of options used by volmaster during the volume create operation.
func (*CreateOptions) ActualSize ¶
func (co *CreateOptions) ActualSize() (uint64, error)
ActualSize returns the size of the volume as an integer of megabytes.
type Global ¶
Global is the global configuration.
func NewGlobalConfig ¶
func NewGlobalConfig() *Global
NewGlobalConfig returns global config with preset defaults
func NewGlobalConfigFromJSON ¶
NewGlobalConfigFromJSON transforms json into a global.
type Policy ¶
type Policy struct {
Name string `json:"name"`
Unlocked bool `json:"unlocked,omitempty" merge:"unlocked"`
CreateOptions CreateOptions `json:"create"`
RuntimeOptions RuntimeOptions `json:"runtime"`
DriverOptions map[string]string `json:"driver"`
FileSystems map[string]string `json:"filesystems"`
Backends BackendDrivers `json:"backends"`
}
Policy is the configuration of the policy. It includes default information for items such as pool and volume configuration.
type RateLimitConfig ¶
type RateLimitConfig struct {
WriteIOPS uint `json:"write-iops" merge:"rate-limit.write.iops"`
ReadIOPS uint `json:"read-iops" merge:"rate-limit.read.iops"`
WriteBPS uint64 `json:"write-bps" merge:"rate-limit.write.bps"`
ReadBPS uint64 `json:"read-bps" merge:"rate-limit.read.bps"`
}
RateLimitConfig is the configuration for limiting the rate of disk access.
type Request ¶
type Request struct {
Volume string `json:"volume"`
Policy string `json:"policy"`
Options map[string]string `json:"options"`
}
Request provides a request structure for communicating with the volmaster.
type RuntimeOptions ¶
type RuntimeOptions struct {
UseSnapshots bool `json:"snapshots" merge:"snapshots"`
Snapshot SnapshotConfig `json:"snapshot"`
RateLimit RateLimitConfig `json:"rate-limit,omitempty"`
}
RuntimeOptions are the set of options used by volplugin when mounting the volume, and by volsupervisor for calculating periodic work.
func (*RuntimeOptions) Validate ¶
func (ro *RuntimeOptions) Validate() error
Validate options for a volume. Should be called anytime options are considered.
type SnapshotConfig ¶
type SnapshotConfig struct {
Frequency string `json:"frequency" merge:"snapshots.frequency"`
Keep uint `json:"keep" merge:"snapshots.keep"`
}
SnapshotConfig is the configuration for snapshots.
type UseLocker ¶
type UseLocker interface {
// GetVolume gets the volume name for this use.
GetVolume() string
// GetReason gets the reason for this use.
GetReason() string
// Type returns the type of lock.
Type() string
// MayExist determines if a key may exist during initial write
MayExist() bool
}
UseLocker is an interface to locks controlled in etcd, or what we call "users".
type UseMount ¶
UseMount is the mount locking mechanism for users. Users are hosts, consumers of a volume. Examples of uses are: creating a volume, using a volume, removing a volume, snapshotting a volume. These are supplied in the `Reason` field as text.
type UseSnapshot ¶
UseSnapshot is similar to UseMount in that it is a locking mechanism, just for snapshots this time. Taking snapshots can block certain actions such as taking other snapshots or deleting snapshots.
func (*UseSnapshot) GetReason ¶
func (us *UseSnapshot) GetReason() string
GetReason gets the reason for this use.
func (*UseSnapshot) GetVolume ¶
func (us *UseSnapshot) GetVolume() string
GetVolume gets the *Volume for this use.
func (*UseSnapshot) MayExist ¶
func (us *UseSnapshot) MayExist() bool
MayExist determines if a key may exist during initial write
type Volume ¶
type Volume struct {
PolicyName string `json:"policy"`
VolumeName string `json:"name"`
Unlocked bool `json:"unlocked,omitempty" merge:"unlocked"`
DriverOptions map[string]string `json:"driver"`
MountSource string `json:"mount" merge:"mount"`
CreateOptions CreateOptions `json:"create"`
RuntimeOptions RuntimeOptions `json:"runtime"`
Backends BackendDrivers `json:"backends"`
}
Volume is the configuration of the policy. It includes pool and snapshot information.
func (*Volume) ToDriverOptions ¶
ToDriverOptions converts a volume to a storage.DriverOptions.