Documentation ¶
Index ¶
- Constants
- type Bundle
- type BundleDataset
- type BundleDatasetType
- type BundleHeartbeat
- type BundleHeartbeatArgs
- type BundleHeartbeatList
- type BundleHeartbeats
- type BundleListResult
- type BundlePayload
- type BundlePort
- type BundlePorts
- type BundleService
- type ClusterConf
- func (c *ClusterConf) BundleHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) DatasetHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) DeleteBundle(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) DeleteDataset(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) DeleteService(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetBundle(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetDHCP(*acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetDataset(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetDefaults(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetNode(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetNodesHistory(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) GetService(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) ListBundleHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) ListBundles(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) ListDatasetHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) ListDatasets(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) ListNodes(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) NodeHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) RegisterTasks(server *provider.Server)
- func (c *ClusterConf) SetDHCP(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) UpdateBundle(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) UpdateDataset(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) UpdateDefaults(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *ClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error)
- type Config
- type ConfigData
- type DHCPConfig
- type Dataset
- type DatasetHeartbeat
- type DatasetHeartbeatArgs
- type DatasetHeartbeatList
- type DatasetListResult
- type DatasetPayload
- type Defaults
- type DefaultsConf
- type DefaultsPayload
- type DeleteBundleArgs
- type GetBundleArgs
- type HealthCheck
- type IDArgs
- type ListBundleArgs
- type ListNodesResult
- type MockClusterConf
- func (c *MockClusterConf) BundleHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) DatasetHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) DeleteBundle(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) DeleteDataset(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) DeleteService(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetBundle(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetDHCP(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetDataset(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetDefaults(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetNode(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetNodesHistory(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) GetService(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) ListBundleHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) ListBundles(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) ListDatasetHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) ListDatasets(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) ListNodes(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) NodeHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) RegisterTasks(server *provider.Server)
- func (c *MockClusterConf) SetDHCP(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) UpdateBundle(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) UpdateDataset(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) UpdateDefaults(req *acomm.Request) (interface{}, *url.URL, error)
- func (c *MockClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error)
- type MockClusterData
- type Node
- type NodeHistory
- type NodeHistoryArgs
- type NodePayload
- type NodesHistory
- type NodesHistoryResult
- type ResourceLimits
- type Service
- type ServiceConf
- type ServiceDataset
- type ServicePayload
Constants ¶
const ( RWZFS = iota TempZFS RAMDisk )
Valid bundle dataset types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct { ID uint64 `json:"id"` Datasets map[string]BundleDataset `json:"datasets"` Services map[string]BundleService `json:"services"` Redundancy uint64 `json:"redundancy"` Ports BundlePorts `json:"ports"` // ModIndex should be treated as opaque, but passed back on updates. ModIndex uint64 `json:"modIndex"` // contains filtered or unexported fields }
Bundle is information about a bundle of services.
type BundleDataset ¶
type BundleDataset struct { Name string `json:"name"` ID string `json:"id"` Type BundleDatasetType `json:"type"` Quota uint64 `json:"type"` }
BundleDataset is configuration for a dataset associated with a bundle.
type BundleDatasetType ¶
type BundleDatasetType int
BundleDatasetType is the type of dataset to be used in a bundle.
type BundleHeartbeat ¶
type BundleHeartbeat struct { IP net.IP `json:"ip"` HealthErrors map[string]error `json:"healthErrors"` }
BundleHeartbeat is bundle heartbeat information.
func (BundleHeartbeat) MarshalJSON ¶
func (b BundleHeartbeat) MarshalJSON() ([]byte, error)
MarshalJSON marshals BundleHeartbeat into a JSON map, converting error values to strings.
func (*BundleHeartbeat) UnmarshalJSON ¶
func (b *BundleHeartbeat) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON into a BundleHeartbeat, converting string values to errors.
type BundleHeartbeatArgs ¶
type BundleHeartbeatArgs struct { ID uint64 `json:"id"` Serial string `json:"serial"` IP net.IP `json:"ip"` HealthErrors map[string]error `json:"healthErrors"` }
BundleHeartbeatArgs are argumenst for updating a bundle heartbeat.
type BundleHeartbeatList ¶
type BundleHeartbeatList struct {
Heartbeats map[uint64]BundleHeartbeats `json:"heartbeats"`
}
BundleHeartbeatList is the result of a ListBundleHeartbeats.
func (BundleHeartbeatList) MarshalJSON ¶
func (b BundleHeartbeatList) MarshalJSON() ([]byte, error)
MarshalJSON marshals BundleHeartbeatList into a JSON map, converting uint keys to strings. TODO: Needed until go 1.7 is released
func (*BundleHeartbeatList) UnmarshalJSON ¶
func (b *BundleHeartbeatList) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON into a BundleHeartbeatList, converting string keys to uints. TODO: Needed until go 1.7 is released
type BundleHeartbeats ¶
type BundleHeartbeats map[string]BundleHeartbeat
BundleHeartbeats are a set of bundle heartbeats for a node.
type BundleListResult ¶
type BundleListResult struct {
Bundles []*Bundle `json:"bundles"`
}
BundleListResult is the result from listing bundles.
type BundlePayload ¶
type BundlePayload struct {
Bundle *Bundle `json:"bundle"`
}
BundlePayload can be used for task args or result when a bundle object needs to be sent.
type BundlePort ¶
type BundlePort struct { Port int `json:"port"` Public bool `json:"public"` ConnectedBundles []string `json:"connectedBundles"` ExternalPort int `json:"externalPort"` }
BundlePort is configuration for a port associated with a bundle.
type BundlePorts ¶
type BundlePorts map[int]BundlePort
BundlePorts is a map of port numbers to port information.
func (BundlePorts) MarshalJSON ¶
func (p BundlePorts) MarshalJSON() ([]byte, error)
MarshalJSON marshals BundlePorts into a JSON map, converting int keys to strings.
func (BundlePorts) UnmarshalJSON ¶
func (p BundlePorts) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON into a BundlePorts, converting string keys to ints.
type BundleService ¶
type BundleService struct { ServiceConf Datasets map[string]ServiceDataset `json:"datasets"` }
BundleService is configuration overrides for a service of a bundle and associated bundles.
type ClusterConf ¶
type ClusterConf struct {
// contains filtered or unexported fields
}
ClusterConf is a provider of cluster configuration functionality.
func New ¶
func New(config *Config, tracker *acomm.Tracker) *ClusterConf
New creates a new instance of ClusterConf
func (*ClusterConf) BundleHeartbeat ¶
BundleHeartbeat registers a new node heartbeat that is using the dataset.
func (*ClusterConf) DatasetHeartbeat ¶
DatasetHeartbeat registers a new node heartbeat that is using the dataset.
func (*ClusterConf) DeleteBundle ¶
DeleteBundle deletes a bundle config.
func (*ClusterConf) DeleteDataset ¶
DeleteDataset deletes a dataset config.
func (*ClusterConf) DeleteService ¶
DeleteService deletes a service config.
func (*ClusterConf) GetDataset ¶
GetDataset retrieves a dataset.
func (*ClusterConf) GetDefaults ¶
GetDefaults retrieves the cluster config.
func (*ClusterConf) GetNodesHistory ¶
GetNodesHistory gets the heartbeat history for one or more nodes.
func (*ClusterConf) GetService ¶
GetService retrieves a service.
func (*ClusterConf) ListBundleHeartbeats ¶
ListBundleHeartbeats returns a list of all active bundle heartbeats.
func (*ClusterConf) ListBundles ¶
ListBundles retrieves a list of all bundles.
func (*ClusterConf) ListDatasetHeartbeats ¶
ListDatasetHeartbeats returns a list of all active dataset heartbeats.
func (*ClusterConf) ListDatasets ¶
ListDatasets returns a list of all Datasets.
func (*ClusterConf) NodeHeartbeat ¶
NodeHeartbeat records a new node heartbeat.
func (*ClusterConf) RegisterTasks ¶
func (c *ClusterConf) RegisterTasks(server *provider.Server)
RegisterTasks registers all of Systemd's task handlers with the server.
func (*ClusterConf) UpdateBundle ¶
UpdateBundle creates or updates a bundle config. When updating, a Get should first be performed and the modified Bundle passed back.
func (*ClusterConf) UpdateDataset ¶
UpdateDataset creates or updates a dataset config. When updating, a Get should first be performed and the modified Dataset passed back.
func (*ClusterConf) UpdateDefaults ¶
UpdateDefaults sets or updates
func (*ClusterConf) UpdateService ¶
UpdateService creates or updates a service config. When updating, a Get should first be performed and the modified Service passed back.
type Config ¶
Config holds all configuration for the provider.
func (*Config) DatasetTTL ¶
DatasetTTL returns the TTL for dataset node heartbeats.
func (*Config) LoadConfig ¶
LoadConfig loads and validates the ClusterConf provider config.
type ConfigData ¶
type ConfigData struct { provider.ConfigData DatasetTTL string `json:"datasetTTL"` BundleTTL string `json:"bundleTTL"` NodeTTL string `json:"nodeTTL"` }
ConfigData defines the structure of the config data (e.g. in the config file)
type DHCPConfig ¶
type DHCPConfig struct { DNS []string `json:"dns"` Duration string `json:"duration"` Gateway string `json:"gateway"` Net string `json:"net"` }
DHCPConfig represents the dhcp settings for the cluster.
func (*DHCPConfig) Validate ¶
func (c *DHCPConfig) Validate() error
Validate validates the DHCPConfig settings.
type Dataset ¶
type Dataset struct { ID string `json:"id"` Parent string `json:"parent"` ParentSameMachine bool `json:"parentSameMachine"` ReadOnly bool `json:"readOnly"` NFS bool `json:"nfs"` Redundancy uint64 `json:"redundancy"` Quota uint64 `json:"quota"` // ModIndex should be treated as opaque, but passed back on updates. ModIndex uint64 `json:"modIndex"` // contains filtered or unexported fields }
Dataset is information about a dataset.
type DatasetHeartbeat ¶
DatasetHeartbeat is dataset heartbeat information.
type DatasetHeartbeatArgs ¶
type DatasetHeartbeatArgs struct { ID string `json:"id"` IP net.IP `json:"ip"` InUse bool `json:"inUse"` }
DatasetHeartbeatArgs are arguments for updating a dataset node heartbeat.
type DatasetHeartbeatList ¶
type DatasetHeartbeatList struct {
Heartbeats map[string]map[string]DatasetHeartbeat
}
DatasetHeartbeatList is the result of a ListDatasetHeartbeats.
type DatasetListResult ¶
type DatasetListResult struct {
Datasets []*Dataset `json:"datasets"`
}
DatasetListResult is the result for listing datasets.
type DatasetPayload ¶
type DatasetPayload struct {
Dataset *Dataset `json:"dataset"`
}
DatasetPayload can be used for task args or result when a dataset object needs to be sent.
type Defaults ¶
type Defaults struct { DefaultsConf ModIndex uint64 `json:"modIndex"` // contains filtered or unexported fields }
Defaults is information about the cluster configuration.
type DefaultsConf ¶
type DefaultsConf struct {
ZFSManual bool `json:"zfsManual"`
}
DefaultsConf is the configuration for the cluster.
type DefaultsPayload ¶
type DefaultsPayload struct {
Defaults *Defaults `json:"defaults"`
}
DefaultsPayload can be used for task args or result when a cluster object needs to be sent.
type DeleteBundleArgs ¶
type DeleteBundleArgs struct {
ID uint64 `json:"id"`
}
DeleteBundleArgs are args for bundle delete task.
type GetBundleArgs ¶
GetBundleArgs are args for retrieving a bundle.
type HealthCheck ¶
type HealthCheck struct { ID string `json:"id"` Type string `json:"type"` Args interface{} `json:"args"` }
HealthCheck is configuration for performing a health check.
type IDArgs ¶
type IDArgs struct {
ID string `json:"id"`
}
IDArgs are arguments for operations requiring only an ID.
type ListBundleArgs ¶
type ListBundleArgs struct {
CombinedOverlay bool `json:"overlay"`
}
ListBundleArgs are args for retrieving a bundle list.
type ListNodesResult ¶
type ListNodesResult struct {
Nodes []Node `json:"nodes"`
}
ListNodesResult is the result of ListNodes.
type MockClusterConf ¶
type MockClusterConf struct {
Data *MockClusterData
}
MockClusterConf is a mock ClusterConf provider.
func NewMockClusterConf ¶
func NewMockClusterConf() *MockClusterConf
NewMockClusterConf creates a new MockClusterConf.
func (*MockClusterConf) BundleHeartbeat ¶
BundleHeartbeat adds a mock bundle heartbeat.
func (*MockClusterConf) DatasetHeartbeat ¶
DatasetHeartbeat adds a mock dataset heartbeat.
func (*MockClusterConf) DeleteBundle ¶
DeleteBundle removes a mock bundle.
func (*MockClusterConf) DeleteDataset ¶
DeleteDataset removes a mock dataset.
func (*MockClusterConf) DeleteService ¶
DeleteService removes a mock service.
func (*MockClusterConf) GetDataset ¶
GetDataset retrieves a mock dataset.
func (*MockClusterConf) GetDefaults ¶
GetDefaults retrieves the mock default values.
func (*MockClusterConf) GetNodesHistory ¶
GetNodesHistory retrieves mock nodes history.
func (*MockClusterConf) GetService ¶
GetService retrieves a mock service.
func (*MockClusterConf) ListBundleHeartbeats ¶
ListBundleHeartbeats list all mock bundle heartbeats.
func (*MockClusterConf) ListBundles ¶
ListBundles retrieves all mock bundles.
func (*MockClusterConf) ListDatasetHeartbeats ¶
ListDatasetHeartbeats lists all mock dataset heartbeats.
func (*MockClusterConf) ListDatasets ¶
ListDatasets lists all mock datasets.
func (*MockClusterConf) NodeHeartbeat ¶
NodeHeartbeat adds a mock node heartbeat.
func (*MockClusterConf) RegisterTasks ¶
func (c *MockClusterConf) RegisterTasks(server *provider.Server)
RegisterTasks registers all of MockClusterConf's tasks.
func (*MockClusterConf) UpdateBundle ¶
UpdateBundle updates a mock bundle.
func (*MockClusterConf) UpdateDataset ¶
UpdateDataset updates a mock dataset.
func (*MockClusterConf) UpdateDefaults ¶
UpdateDefaults updates the mock default values.
func (*MockClusterConf) UpdateService ¶
UpdateService updates a mock service.
type MockClusterData ¶
type MockClusterData struct { Services map[string]*Service Bundles map[uint64]*Bundle BundlesHB map[uint64]BundleHeartbeats Datasets map[string]*Dataset DatasetsHB map[string]map[string]DatasetHeartbeat Nodes map[string]*Node History NodesHistory Defaults *Defaults DHCP *DHCPConfig }
MockClusterData is the in-memory data structure for a MockClusterConf.
type Node ¶
type Node struct { ID string `json:"id"` Heartbeat time.Time `json:"heartbeat"` MemoryTotal uint64 `json:"memoryTotal"` MemoryFree uint64 `json:"memoryFree"` CPUCores int `json:"cpuCores"` CPULoad load.AvgStat `json:"cpuLoad"` DiskTotal uint64 `json:"diskTotal"` DiskFree uint64 `json:"diskFree"` // contains filtered or unexported fields }
Node is current information about a hardware node.
type NodeHistory ¶
NodeHistory is a set of historical information for a node.
type NodeHistoryArgs ¶
type NodeHistoryArgs struct { IDs []string `json:"ids"` Before time.Time `json:"before"` After time.Time `json:"after"` }
NodeHistoryArgs are arguments for filtering the historical results for nodes.
type NodePayload ¶
type NodePayload struct {
Node *Node `json:"node"`
}
NodePayload can be used for task args or result when a node object needs to be sent.
type NodesHistory ¶
type NodesHistory map[string]NodeHistory
NodesHistory is the historical information for multiple nodes.
type NodesHistoryResult ¶
type NodesHistoryResult struct {
History NodesHistory `json:"history"`
}
NodesHistoryResult is the result from the GetNodesHistory handler.
type ResourceLimits ¶
type ResourceLimits struct { CPU int `json:"cpu"` Memory int64 `json:"memory"` Processes int `json:"processes"` }
ResourceLimits is configuration for resource upper bounds.
type Service ¶
type Service struct { ServiceConf // ModIndex should be treated as opaque, but passed back on updates ModIndex uint64 `json:"modIndex"` // contains filtered or unexported fields }
Service is information about a service.
type ServiceConf ¶
type ServiceConf struct { ID string `json:"id"` Dataset string `json:"dataset"` HealthChecks map[string]HealthCheck `json:"healthChecks"` Limits ResourceLimits `json:"limits"` Env map[string]string `json:"env"` Cmd []string `json:"cmd"` }
ServiceConf is the configuration of a service.
type ServiceDataset ¶
type ServiceDataset struct { Name string `json:"name"` MountPoint string `json:"mountPoint"` ReadOnly bool `json:"readOnly"` }
ServiceDataset is configuration for mounting a dataset for a bundle service.
type ServicePayload ¶
type ServicePayload struct {
Service *Service `json:"service"`
}
ServicePayload can be used for task args or result when a service object needs to be sent.