juju: github.com/juju/juju/worker/peergrouper Index | Files

package peergrouper

import "github.com/juju/juju/worker/peergrouper"

Index

Package Files

controllertracker.go desired.go initiate.go manifold.go publish.go shim.go worker.go

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
)

func InitiateMongoServer Uses

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 Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run a peergrouper.

func New Uses

func New(config Config) (worker.Worker, error)

New returns a new worker that maintains the mongo replica set with respect to the given state.

type APIHostPortsSetter Uses

type APIHostPortsSetter interface {
    SetAPIHostPorts([]network.SpaceHostPorts) error
}

type CachingAPIHostPortsSetter Uses

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 Uses

func (s *CachingAPIHostPortsSetter) SetAPIHostPorts(apiServers []network.SpaceHostPorts) error

type Config Uses

type Config struct {
    State              State
    APIHostPortsSetter APIHostPortsSetter
    MongoSession       MongoSession
    Clock              clock.Clock
    MongoPort          int
    APIPort            int
    ControllerAPIPort  int

    // 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

    // UpdateNotify is called when the update channel is signalled.
    // Used solely for test synchronization.
    UpdateNotify func()
}

Config holds the configuration for a peergrouper worker.

func (Config) Validate Uses

func (config Config) Validate() error

Validate validates the worker configuration.

type ControllerHost Uses

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 Uses

type ControllerNode interface {
    Id() string
    Refresh() error
    Watch() state.NotifyWatcher
    WantsVote() bool
    HasVote() bool
    SetHasVote(hasVote bool) error
}

type Hub Uses

type Hub interface {
    Subscribe(topic string, handler interface{}) (func(), error)
    Publish(topic string, data interface{}) (<-chan struct{}, error)
}

Hub defines the methods of the apiserver centralhub that the peer grouper uses.

type InitiateMongoParams Uses

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 Uses

type ManifoldConfig struct {
    AgentName          string
    ClockName          string
    ControllerPortName string
    StateName          string
    Hub                Hub
    NewWorker          func(Config) (worker.Worker, error)
}

ManifoldConfig holds the information necessary to run a peergrouper in a dependency.Engine.

func (ManifoldConfig) Validate Uses

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type MongoSession Uses

type MongoSession interface {
    CurrentStatus() (*replicaset.Status, error)
    CurrentMembers() ([]replicaset.Member, error)
    Set([]replicaset.Member) error
    StepDownPrimary() error
    Refresh()
}

type MongoSessionShim Uses

type MongoSessionShim struct {
    *mgo.Session
}

MongoSessionShim wraps a *mgo.Session to conform to the MongoSession interface.

func (MongoSessionShim) CurrentMembers Uses

func (s MongoSessionShim) CurrentMembers() ([]replicaset.Member, error)

func (MongoSessionShim) CurrentStatus Uses

func (s MongoSessionShim) CurrentStatus() (*replicaset.Status, error)

func (MongoSessionShim) Refresh Uses

func (s MongoSessionShim) Refresh()

func (MongoSessionShim) Set Uses

func (s MongoSessionShim) Set(members []replicaset.Member) error

func (MongoSessionShim) StepDownPrimary Uses

func (s MongoSessionShim) StepDownPrimary() error

type Space Uses

type Space interface {
    NetworkSpace() network.SpaceInfo
}

type State Uses

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 Uses

type StateShim struct {
    *state.State
}

func (StateShim) ControllerHost Uses

func (s StateShim) ControllerHost(id string) (ControllerHost, error)

func (StateShim) ControllerNode Uses

func (s StateShim) ControllerNode(id string) (ControllerNode, error)

func (StateShim) RemoveControllerReference Uses

func (s StateShim) RemoveControllerReference(c ControllerNode) error

func (StateShim) Space Uses

func (s StateShim) Space(name string) (Space, error)

Package peergrouper imports 27 packages (graph) and is imported by 146 packages. Updated 2019-09-28. Refresh now. Tools for package owners.