Documentation ¶
Index ¶
- Constants
- Variables
- type BackendDrivers
- type Client
- func (c *Client) CreatePolicyRevision(name string, policy string) error
- func (c *Client) CreateVolume(rc *VolumeRequest) (*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) GetPolicyRevision(name, revision string) (string, 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) IsVolumeInUse(cfg *Volume) (bool, error)
- func (c *Client) ListAllVolumes() ([]string, error)
- func (c *Client) ListPolicies() ([]Policy, error)
- func (c *Client) ListPolicyRevisions(name string) ([]string, 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 (c *Client) WatchForPolicyChanges(activity chan *watch.Watch)
- 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 RuntimeOptions
- type SnapshotConfig
- type UseLocker
- type UseMount
- type UseSnapshot
- type Volume
- type VolumeRequest
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 ( // RuntimeSchema defines json schema for runtime configuration RuntimeSchema = `` /* 459-byte string literal not displayed */ // PolicySchema defines the json schema for policy PolicySchema = `` /* 614-byte string literal not displayed */ //VolumeSchema defines the json schema for volume VolumeSchema = `` /* 578-byte string literal not displayed */ )
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) CreatePolicyRevision ¶ added in v0.3.0
CreatePolicyRevision creates an revision entry in a policy's history.
func (*Client) CreateVolume ¶
func (c *Client) CreateVolume(rc *VolumeRequest) (*Volume, error)
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) GetPolicyRevision ¶ added in v0.3.0
GetPolicyRevision returns a single revision for a given policy.
func (*Client) GetVolumeRuntime ¶
func (c *Client) GetVolumeRuntime(policy, name string) (RuntimeOptions, error)
GetVolumeRuntime retrieves only the runtime parameters for the volume.
func (*Client) IsVolumeInUse ¶ added in v0.3.0
IsVolumeInUse checks if the given volume is mounted in any container
func (*Client) ListAllVolumes ¶
ListAllVolumes returns an array with all the named policies and volumes the apiserver 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) ListPolicyRevisions ¶ added in v0.3.0
ListPolicyRevisions returns a list of all the revisions for a given 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) WatchForPolicyChanges ¶ added in v0.3.0
WatchForPolicyChanges creates a watch which returns the policy name and revision whenever a new policy is uploaded.
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 apiserver 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.
func (*Global) Canonical ¶ added in v0.2.0
Canonical returns a copy of the current global with the parameters adjusted to fit the internal (or canonical) representation. To see the published version, see Published() above.
It is very important that you do not run this function multiple times against the same data set. It will adjust the parameters twice.
func (*Global) Published ¶ added in v0.2.0
Published returns a copy of the current global with the parameters adjusted to fit the published representation. To see the internal/system/canonical version, please see Canonical() below.
It is very important that you do not run this function multiple times against the same data set. It will adjust the parameters twice.
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,omitempty"` Backend string `json:"backend,omitempty"` }
Policy is the configuration of the policy. It includes default information for items such as pool and volume configuration.
func NewPolicy ¶
func NewPolicy() *Policy
NewPolicy return policy config with specified backend preset
func (*Policy) ValidateJSON ¶ added in v0.3.0
ValidateJSON validates the given policy against its defined schema
type RateLimitConfig ¶
type RateLimitConfig struct { 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 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) ValidateJSON ¶ added in v0.3.0
func (cfg *RuntimeOptions) ValidateJSON() error
ValidateJSON validates the given runtime against its defined schema
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,omitempty"` }
Volume is the configuration of the policy. It includes pool and snapshot information.
func (*Volume) ToDriverOptions ¶
ToDriverOptions converts a volume to a storage.DriverOptions.
func (*Volume) ValidateJSON ¶ added in v0.3.0
ValidateJSON validates the given volume against its defined schema
type VolumeRequest ¶ added in v0.3.0
type VolumeRequest struct { Name string `json:"name"` Policy string `json:"policy"` Options map[string]string `json:"options"` }
VolumeRequest provides a request structure for communicating volumes to the apiserver or internally. it is the basic representation of a volume.
func (*VolumeRequest) String ¶ added in v0.3.0
func (v *VolumeRequest) String() string