Documentation ¶
Index ¶
- Variables
- func AccountedDiscoverInstance(instanceKey inst.InstanceKey, pendingTokens chan bool, ...)
- func AttemptElection() (bool, error)
- func AttemptRecoveryRegistration(failedKey *inst.InstanceKey) (bool, error)
- func CheckAndRecover(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, ...) (actionTaken bool, instance *inst.Instance, err error)
- func ClearActiveRecoveries() error
- func ContinuousAgentsPoll()
- func ContinuousDiscovery()
- func DiscoverInstance(instanceKey inst.InstanceKey)
- func ElectedNode() (string, string, bool, error)
- func GetCandidateSiblingOfIntermediateMaster(intermediateMasterKey *inst.InstanceKey) (*inst.Instance, error)
- func GetHash(input []byte) string
- func GetRandomData() []byte
- func GrabElection() (bool, error)
- func IsElected() (bool, error)
- func RecoverDeadIntermediateMaster(failedInstanceKey *inst.InstanceKey) (bool, *inst.Instance, error)
- func RecoverDeadMaster(failedInstanceKey *inst.InstanceKey) (bool, *inst.Instance, error)
- func ResolveRecovery(failedKey *inst.InstanceKey, successorKey *inst.InstanceKey) error
- func StartDiscovery(instanceKey inst.InstanceKey)
- type HealthStatus
- type InstancesByCountSlaves
- type Token
Constants ¶
This section is empty.
Variables ¶
var ThisHostname string
Functions ¶
func AccountedDiscoverInstance ¶
func AccountedDiscoverInstance(instanceKey inst.InstanceKey, pendingTokens chan bool, completedTokens chan bool)
AccountedDiscoverInstance will call upon DiscoverInstance and will keep track of discovery tokens such that management of multiple discoveries can figure out whether all instances in a topology are accounted for.
func AttemptElection ¶ added in v1.2.20
AttemptElection tries to grab leadership (become active node)
func AttemptRecoveryRegistration ¶ added in v1.4.21
func AttemptRecoveryRegistration(failedKey *inst.InstanceKey) (bool, error)
AttemptRecoveryRegistration tries to add a recovery entry; if this fails that means recovery is already in place.
func CheckAndRecover ¶ added in v1.4.21
func CheckAndRecover(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, skipFilters bool) (actionTaken bool, instance *inst.Instance, err error)
CheckAndRecover is the main entry point for the recovery mechanism
func ClearActiveRecoveries ¶ added in v1.4.21
func ClearActiveRecoveries() error
ClearActiveRecoveries clears the "in_active_period" flag for old-enough recoveries, thereby allowing for further recoveries on cleared instances.
func ContinuousAgentsPoll ¶ added in v1.1.2
func ContinuousAgentsPoll()
ContinuousAgentsPoll starts an asynchronuous infinite process where agents are periodically investigated and their status captured, and long since unseen agents are purged and forgotten.
func ContinuousDiscovery ¶
func ContinuousDiscovery()
ContinuousDiscovery starts an asynchronuous infinite discovery process where instances are periodically investigated and their status captured, and long since unseen instances are purged and forgotten.
func DiscoverInstance ¶
func DiscoverInstance(instanceKey inst.InstanceKey)
DiscoverInstance will attempt discovering an instance (unless it is already up to date) and will list down its master and slaves (if any) for further discovery.
func ElectedNode ¶ added in v1.3.22
ElectedNode returns the hostname of the elected node
func GetCandidateSiblingOfIntermediateMaster ¶ added in v1.4.21
func GetCandidateSiblingOfIntermediateMaster(intermediateMasterKey *inst.InstanceKey) (*inst.Instance, error)
GetCandidateSlave chooses the best slave to promote given a (possibly dead) master
func GetRandomData ¶ added in v1.2.20
func GetRandomData() []byte
func GrabElection ¶ added in v1.3.22
GrabElection forcibly grabs leadership. Use with care!!
func RecoverDeadIntermediateMaster ¶ added in v1.4.21
func RecoverDeadMaster ¶ added in v1.4.21
func ResolveRecovery ¶ added in v1.4.21
func ResolveRecovery(failedKey *inst.InstanceKey, successorKey *inst.InstanceKey) error
ResolveRecovery is called on completion of a recovery process and updates the recovery status. It does not clear the "active period" as this still takes place in order to avoid flapping.
func StartDiscovery ¶
func StartDiscovery(instanceKey inst.InstanceKey)
Start discovery begins a one time asynchronuous discovery process for the given instance and all of its topology connected instances. That is, the instance will be investigated for master and slaves, and the routines will follow on each and every such found master/slave. In essense, assuming all slaves in a replication topology are running, and given a single instance in such topology, this function will detect the entire topology.
Types ¶
type HealthStatus ¶ added in v1.3.22
type HealthStatus struct { Healthy bool Hostname string Token string IsActiveNode bool ActiveNode string Error error }
func HealthTest ¶ added in v1.3.10
func HealthTest() (*HealthStatus, error)
HealthTest attempts to write to the backend database and get a result
type InstancesByCountSlaves ¶ added in v1.4.21
InstancesByCountSlaves sorts instances by umber of slaves, descending
func (InstancesByCountSlaves) Len ¶ added in v1.4.21
func (this InstancesByCountSlaves) Len() int
func (InstancesByCountSlaves) Less ¶ added in v1.4.21
func (this InstancesByCountSlaves) Less(i, j int) bool
func (InstancesByCountSlaves) Swap ¶ added in v1.4.21
func (this InstancesByCountSlaves) Swap(i, j int)