Documentation ¶
Index ¶
- Variables
- func InitiateMongoServer(p InitiateMongoParams) error
- func Manifold(config ManifoldConfig) dependency.Manifold
- func New(config Config) (worker.Worker, error)
- type APIHostPortsSetter
- type CachingAPIHostPortsSetter
- type Collector
- type Config
- type ControllerHost
- type ControllerNode
- type Hub
- type InitiateMongoParams
- type ManifoldConfig
- type MongoSession
- type MongoSessionShim
- type Space
- type State
- type StateShim
Constants ¶
This section is empty.
Variables ¶
var ( // IdleFunc allows tests to be able to get callbacks when the controller // hasn't been given any changes for a specified time. IdleFunc func() // IdleTime relates to how long the controller needs to wait with no changes // to be considered idle. IdleTime = 50 * time.Millisecond )
Functions ¶
func InitiateMongoServer ¶
func InitiateMongoServer(p InitiateMongoParams) error
InitiateMongoServer checks for an existing mongo configuration. If no existing configuration is found one is created using Initiate.
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency.Manifold that will run a peergrouper.
Types ¶
type APIHostPortsSetter ¶
type APIHostPortsSetter interface {
SetAPIHostPorts([]network.SpaceHostPorts) error
}
type CachingAPIHostPortsSetter ¶
type CachingAPIHostPortsSetter struct { APIHostPortsSetter // contains filtered or unexported fields }
CachingAPIHostPortsSetter is an APIHostPortsSetter that caches the most recently set values, suppressing further calls to the underlying setter if any call's arguments match those of the preceding call.
func (*CachingAPIHostPortsSetter) SetAPIHostPorts ¶
func (s *CachingAPIHostPortsSetter) SetAPIHostPorts(apiServers []network.SpaceHostPorts) error
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is a prometheus.Collector that collects metrics about the mongo replicaset status.
func NewMetricsCollector ¶
func NewMetricsCollector() *Collector
NewMetricsCollector returns a new Collector.
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric)
Collect is part of the prometheus.Collector interface.
func (*Collector) Describe ¶
func (c *Collector) Describe(ch chan<- *prometheus.Desc)
Describe is part of the prometheus.Collector interface.
type Config ¶
type Config struct { State State APIHostPortsSetter APIHostPortsSetter MongoSession MongoSession Clock clock.Clock MongoPort int APIPort int ControllerAPIPort int // ControllerId is the id of the controller running this worker. // It is used in checking if this working is running on the // primary mongo node. ControllerId func() string // Kubernetes controllers do not support HA yet. SupportsHA bool // Hub is the central hub of the apiserver, // and is used to publish the details of the // API servers. Hub Hub PrometheusRegisterer prometheus.Registerer // UpdateNotify is called when the update channel is signalled. // Used solely for test synchronization. UpdateNotify func() }
Config holds the configuration for a peergrouper worker.
type ControllerHost ¶
type ControllerHost interface { Id() string Life() state.Life Watch() state.NotifyWatcher Status() (status.StatusInfo, error) SetStatus(status.StatusInfo) error Refresh() error Addresses() network.SpaceAddresses }
type ControllerNode ¶
type Hub ¶
type Hub interface { Subscribe(topic string, handler interface{}) (func(), error) Publish(topic string, data interface{}) (func(), error) }
Hub defines the methods of the apiserver centralhub that the peer grouper uses.
type InitiateMongoParams ¶
type InitiateMongoParams struct { // DialInfo specifies how to connect to the mongo server. DialInfo *mgo.DialInfo // MemberHostPort provides the address to use for // the first replica set member. MemberHostPort string // User holds the user to log as in to the mongo server. // If it is empty, no login will take place. User string Password string }
InitiateMongoParams holds parameters for the MaybeInitiateMongo call.
type ManifoldConfig ¶
type ManifoldConfig struct { AgentName string ClockName string ControllerPortName string StateName string Hub Hub PrometheusRegisterer prometheus.Registerer NewWorker func(Config) (worker.Worker, error) }
ManifoldConfig holds the information necessary to run a peergrouper in a dependency.Engine.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
Validate validates the manifold configuration.
type MongoSession ¶
type MongoSessionShim ¶
type MongoSessionShim struct {
*mgo.Session
}
MongoSessionShim wraps a *mgo.Session to conform to the MongoSession interface.
func (MongoSessionShim) CurrentMembers ¶
func (s MongoSessionShim) CurrentMembers() ([]replicaset.Member, error)
func (MongoSessionShim) CurrentStatus ¶
func (s MongoSessionShim) CurrentStatus() (*replicaset.Status, error)
func (MongoSessionShim) Refresh ¶
func (s MongoSessionShim) Refresh()
func (MongoSessionShim) Set ¶
func (s MongoSessionShim) Set(members []replicaset.Member) error
func (MongoSessionShim) StepDownPrimary ¶
func (s MongoSessionShim) StepDownPrimary() error
type State ¶
type State interface { RemoveControllerReference(m ControllerNode) error ControllerConfig() (controller.Config, error) ControllerIds() ([]string, error) ControllerNode(id string) (ControllerNode, error) ControllerHost(id string) (ControllerHost, error) WatchControllerInfo() state.StringsWatcher WatchControllerStatusChanges() state.StringsWatcher WatchControllerConfig() state.NotifyWatcher Space(name string) (Space, error) }
type StateShim ¶
func (StateShim) ControllerHost ¶
func (s StateShim) ControllerHost(id string) (ControllerHost, error)
func (StateShim) ControllerNode ¶
func (s StateShim) ControllerNode(id string) (ControllerNode, error)
func (StateShim) RemoveControllerReference ¶
func (s StateShim) RemoveControllerReference(c ControllerNode) error