config

package
v0.0.0-...-08a0563 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigFilePath

func DefaultConfigFilePath() string

DefaultConfigFilePath returns the context-sensitive default configuration file path.

Types

type Configuration

type Configuration struct {
	ID             uuid.UUID
	Up             bool
	Peers          *Peers
	ContextFactory model.AppContextFactory

	Port                      int
	Address                   string
	AllowCors                 string
	AgentUpdateInterval       int
	PeerUpdateInterval        int
	PeerCheckInterval         int
	RemoteCheckUpdateInterval int
	RemoteCheckAssignInterval int
	MongoHost                 string
	MongoDatabase             string
	MongoUser                 string
	MongoPassword             string
	BootstrapPeers            []string
	SMTPHost                  string
	SMTPPort                  int
	SMTPUser                  string
	SMTPPassword              string
	EmailFrom                 string
}

Configuration describes the configuration of the coordinator instance.

func LoadConfig

func LoadConfig(filePath string) (Configuration, error)

LoadConfig from file, overriding defaults with values from file.

func New

func New() Configuration

New produces a Configuration filled with defaults.

func (Configuration) AgentUpdateDuration

func (c Configuration) AgentUpdateDuration() time.Duration

AgentUpdateDuration from AgentUpdateInterval

func (Configuration) Endpoint

func (c Configuration) Endpoint() string

Endpoint address for this coordinator (Address:Port)

func (*Configuration) Init

func (c *Configuration) Init()

Init initializes configuration based on current settings.

func (Configuration) IsLeader

func (c Configuration) IsLeader() bool

IsLeader returns true if this instance is the cluster leader.

func (Configuration) PeerCheckDuration

func (c Configuration) PeerCheckDuration() time.Duration

PeerCheckDuration from PeerCheckInterval

func (Configuration) PeerUpdateDuration

func (c Configuration) PeerUpdateDuration() time.Duration

PeerUpdateDuration from PeerUpdateInterval

func (Configuration) RemoteCheckAssignDuration

func (c Configuration) RemoteCheckAssignDuration() time.Duration

RemoteCheckAssignDuration from RemoteCheckAssignInterval

func (Configuration) RemoteCheckUpdateDuration

func (c Configuration) RemoteCheckUpdateDuration() time.Duration

RemoteCheckUpdateDuration from RemoteCheckUpdateInterval

func (Configuration) URLForPath

func (c Configuration) URLForPath(path string) string

URLForPath returns the full URL for a given API route path.

type PeerSet

type PeerSet map[uuid.UUID]string

PeerSet manages a set of peer Coordinators, mapping unique IDs to endpoints.

func (PeerSet) Contains

func (ps PeerSet) Contains(id uuid.UUID) bool

Contains returns true if the PeerSet contains the given coordinator ID.

func (PeerSet) Copy

func (ps PeerSet) Copy() PeerSet

Copy creates a deep copy of this PeerSet.

func (PeerSet) EndpointArray

func (ps PeerSet) EndpointArray() []string

EndpointArray returns an array of the endpoints in this PeerSet.

func (PeerSet) IsLeader

func (ps PeerSet) IsLeader(id uuid.UUID) bool

IsLeader returns true if the given node is leader (most senior by ID).

type Peers

type Peers struct {
	PeerCheckDuration  time.Duration
	PeerUpdateDuration time.Duration
	// contains filtered or unexported fields
}

Peers type handles peer management.

func NewPeers

func NewPeers() *Peers

NewPeers constructor.

func (*Peers) AddPeer

func (p *Peers) AddPeer(peer string)

AddPeer to the known peers list. It will not be added to alive peers until the next peer check, and its known peers won't be added until the next peer update.

func (*Peers) AlivePeerSet

func (p *Peers) AlivePeerSet() PeerSet

AlivePeerSet returns the set of known live peers as of last check.

func (*Peers) KnownPeerSet

func (p *Peers) KnownPeerSet() PeerSet

KnownPeerSet returns the set of known peers (regardless of status) as of last update.

func (*Peers) Run

Run the peer management routine and return a channel for signalling the routine to stop. Once stopped, all calls to AlivePeerSet/KnownPeerSet/Add will block indefinitely.

Jump to

Keyboard shortcuts

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