Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
// contains filtered or unexported fields
}
Candidate runs the leader election algorithm asynchronously
func NewCandidate ¶
NewCandidate creates a new Candidate
func (*Candidate) ElectedCh ¶
ElectedCh is used to get a channel which delivers signals on acquiring or losing leadership. It sends true if we become the leader, and false if we lose it.
func (*Candidate) Resign ¶
func (c *Candidate) Resign()
Resign forces the candidate to step-down and try again. If the candidate is not a leader, it doesn't have any effect. Candidate will retry immediately to acquire the leadership. If no-one else took it, then the Candidate will end up being a leader again.
func (*Candidate) RunForElection ¶
RunForElection starts the leader election algorithm. Updates in status are pushed through the ElectedCh channel.
type Follower ¶
type Follower struct {
// contains filtered or unexported fields
}
Follower can folow an election in real-time and push notifications whenever there is a change in leadership.
func NewFollower ¶
NewFollower creates a new follower.
func (*Follower) FollowElection ¶
FollowElection starts monitoring the election.