config

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExist = errors.New("Already exists")

ErrExist indicates when a key in etcd exits already. Used for create logic.

Functions

This section is empty.

Types

type MountConfig

type MountConfig struct {
	Volume     string
	Pool       string
	MountPoint string
	Host       string
}

MountConfig is the exchange configuration for mounts. The payload is stored in etcd and used for comparison.

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"`
	Tenant string `json:"tenant"`
}

Request provides a request structure for communicating with the volmaster.

type RequestCreate

type RequestCreate struct {
	Tenant string            `json:"tenant"`
	Volume string            `json:"volume"`
	Opts   map[string]string `json:"opts"`
}

RequestCreate provides a request structure for creating new volumes.

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 TenantConfig

type TenantConfig struct {
	DefaultVolumeOptions VolumeOptions     `json:"default-options"`
	FileSystems          map[string]string `json:"filesystems"`
}

TenantConfig is the configuration of the tenant. It includes default information for items such as pool and volume configuration.

func (*TenantConfig) Validate

func (cfg *TenantConfig) Validate() error

Validate ensures the structure of the tenant is sane.

type TopLevelConfig

type TopLevelConfig struct {
	// contains filtered or unexported fields
}

TopLevelConfig is the top-level struct for communicating with the intent store.

func NewTopLevelConfig

func NewTopLevelConfig(prefix string, etcdHosts []string) (*TopLevelConfig, error)

NewTopLevelConfig creates a TopLevelConfig struct which can drive communication with the configuration store.

func (*TopLevelConfig) CreateVolume

func (c *TopLevelConfig) CreateVolume(rc RequestCreate) (*VolumeConfig, error)

CreateVolume sets the appropriate config metadata for a volume creation operation, and returns the VolumeConfig that was copied in.

func (*TopLevelConfig) DeleteTenant

func (c *TopLevelConfig) DeleteTenant(name string) error

DeleteTenant removes a tenant from the configuration store.

func (*TopLevelConfig) GetMount

func (c *TopLevelConfig) GetMount(pool, name string) (*MountConfig, error)

GetMount retrieves the MountConfig for the given volume name.

func (*TopLevelConfig) GetTenant

func (c *TopLevelConfig) GetTenant(name string) (*TenantConfig, error)

GetTenant retrieves a tenant from the configuration store.

func (*TopLevelConfig) GetVolume

func (c *TopLevelConfig) GetVolume(tenant, name string) (*VolumeConfig, error)

GetVolume returns the VolumeConfig for a given volume.

func (*TopLevelConfig) ListAllVolumes

func (c *TopLevelConfig) ListAllVolumes() ([]string, error)

ListAllVolumes returns an array with all the named tenants and volumes the volmaster knows about. Volumes have syntax: tenant/volumeName which will be reflected in the returned string.

func (*TopLevelConfig) ListMounts

func (c *TopLevelConfig) ListMounts() ([]string, error)

ListMounts lists the mounts in use.

func (*TopLevelConfig) ListTenants

func (c *TopLevelConfig) ListTenants() ([]string, error)

ListTenants provides an array of strings corresponding to the name of each tenant.

func (*TopLevelConfig) ListVolumes

func (c *TopLevelConfig) ListVolumes(tenant string) (map[string]*VolumeConfig, error)

ListVolumes returns a map of volume name -> VolumeConfig.

func (*TopLevelConfig) PublishMount

func (c *TopLevelConfig) PublishMount(mt *MountConfig) error

PublishMount pushes the mount to etcd.

func (*TopLevelConfig) PublishTenant

func (c *TopLevelConfig) PublishTenant(name string, cfg *TenantConfig) error

PublishTenant publishes tenant intent to the configuration store.

func (*TopLevelConfig) RemoveMount

func (c *TopLevelConfig) RemoveMount(mt *MountConfig, force bool) error

RemoveMount will remove a mount from etcd. Does not fail if the mount does not exist.

func (*TopLevelConfig) RemoveVolume

func (c *TopLevelConfig) RemoveVolume(tenant, name string) error

RemoveVolume removes a volume from configuration.

type VolumeConfig

type VolumeConfig struct {
	TenantName string         `json:"tenant"`
	VolumeName string         `json:"name"`
	Options    *VolumeOptions `json:"options"`
}

VolumeConfig is the configuration of the tenant. It includes pool and snapshot information.

func (*VolumeConfig) Validate

func (cfg *VolumeConfig) Validate() error

Validate validates a volume configuration, returning error on any issue.

type VolumeOptions

type VolumeOptions struct {
	Pool         string          `json:"pool" merge:"pool"`
	Size         uint64          `json:"size" merge:"size"`
	UseSnapshots bool            `json:"snapshots" merge:"snapshots"`
	Snapshot     SnapshotConfig  `json:"snapshot"`
	FileSystem   string          `json:"filesystem" merge:"filesystem"`
	Ephemeral    bool            `json:"ephemeral,omitempty" merge:"ephemeral"`
	RateLimit    RateLimitConfig `json:"rate-limit,omitempty"`
}

VolumeOptions comprises the optional paramters a volume can accept.

func (*VolumeOptions) Validate

func (opts *VolumeOptions) Validate() error

Validate options for a volume. Should be called anytime options are considered.

Jump to

Keyboard shortcuts

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