Documentation ¶
Index ¶
- Variables
- func AttemptElection() (bool, error)
- func ContinuousRegistration(extraInfo string, command string)
- func ExpireAvailableNodes()
- func ExpireNodesHistory() error
- func GrabElection() error
- func Reelect() error
- func RegisterNode(nodeHealth *NodeHealth) (healthy bool, err error)
- func SinceLastGoodHealthCheck() time.Duration
- func SinceLastHealthCheck() time.Duration
- func TokenBelongsToHealthyHttpService(token string) (result bool, err error)
- func WriteRegisterNode(nodeHealth *NodeHealth) (healthy bool, err error)
- type ExecutionMode
- type HealthStatus
- type NodeHealth
Constants ¶
This section is empty.
Variables ¶
var LastContinousCheckHealthy int64
var ThisNodeHealth = NewNodeHealth()
Functions ¶
func AttemptElection ¶
AttemptElection tries to grab leadership (become active node)
func ContinuousRegistration ¶
ContinuousRegistration will continuously update the ham_node_health table showing that the current process is still running.
func ExpireAvailableNodes ¶
func ExpireAvailableNodes()
ExpireAvailableNodes is an aggressive purging method to remove node entries who have skipped their keepalive for two times.
func ExpireNodesHistory ¶
func ExpireNodesHistory() error
ExpireNodesHistory cleans up the nodes history and is run by the ham4db active node.
func GrabElection ¶
func GrabElection() error
GrabElection forcibly grabs leadership. Use with care!!
func Reelect ¶
func Reelect() error
Reelect clears the way for re-elections. Active node is immediately demoted.
func RegisterNode ¶
func RegisterNode(nodeHealth *NodeHealth) (healthy bool, err error)
func SinceLastHealthCheck ¶
func WriteRegisterNode ¶
func WriteRegisterNode(nodeHealth *NodeHealth) (healthy bool, err error)
RegisterNode writes down this node in the ham_node_health table
Types ¶
type ExecutionMode ¶
type ExecutionMode string
const ( ExecutionCliMode ExecutionMode = "CLIMode" ExecutionHttpMode = "HttpMode" )
type HealthStatus ¶
type HealthStatus struct { Healthy bool Hostname string Token string IsActiveNode bool ActiveNode NodeHealth Error error AvailableNodes [](*NodeHealth) RaftLeader string IsRaftLeader bool RaftLeaderURI string RaftAdvertise string RaftHealthyMembers []string }
func HealthTest ¶
func HealthTest() (health *HealthStatus, err error)
HealthTest attempts to write to the backend database and get a result
type NodeHealth ¶
type NodeHealth struct { Hostname string Token string AppVersion string FirstSeenActive string LastSeenActive string ExtraInfo string Command string DBBackend string LastReported time.Time // contains filtered or unexported fields }
func ElectedNode ¶
func ElectedNode() (node NodeHealth, isElected bool, err error)
ElectedNode returns the details of the elected node, as well as answering the question "is this process the elected one"?
func NewNodeHealth ¶
func NewNodeHealth() *NodeHealth
func ReadAvailableNodes ¶
func ReadAvailableNodes(onlyHttpNodes bool) (nodes [](*NodeHealth), err error)
func (*NodeHealth) Update ¶
func (nodeHealth *NodeHealth) Update() *NodeHealth