Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elector ¶
type Elector interface { // Stop stop elector Stop(frag uint64) // CurrentLeader returns current leader CurrentLeader(frag uint64) (uint64, error) // ElectionLoop run leader election loop ElectionLoop(ctx context.Context, frag, currentPeerID uint64, nodeChecker func(uint64) bool, becomeLeader, becomeFollower func()) // ChangeLeaderTo change leader to ChangeLeaderTo(frag uint64, oldLeader, newLeader uint64) error }
Elector leader election
func NewElector ¶
NewElector create a elector by options
type Option ¶
type Option func(*options)
Option option for election
func WithLeaderLeaseSec ¶
WithLeaderLeaseSec set leader lease time in seconds
Click to show internal directories.
Click to hide internal directories.