Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControlLoop ¶
type ControlLoop struct {
// contains filtered or unexported fields
}
Helps adapt systems that provide asynchronous notifications of leadership changes (*cough* *cough* Kubernetes *cough*) into mutually exclusive leader/follower states.
func StartControlLoop ¶
func (*ControlLoop) BecomeFollower ¶
func (l *ControlLoop) BecomeFollower(leader string)
func (*ControlLoop) BecomeLeader ¶
func (l *ControlLoop) BecomeLeader(isLeaseAcceptable func(expiredToleration time.Duration) error)
func (*ControlLoop) StopAndWait ¶
func (l *ControlLoop) StopAndWait() error
type Follower ¶
type Follower interface { // Runs when the member is a follower of another member. The context is // cancelled if this node is notified a member on another node (possibly // this node) has become the leader. Returning nil or context.Canceled is // a signal to a Coordinator that the followship was successful. Returning // another value of error won't necessarily do anything, but may cause a // calling Coordinator to try and become the leader. Follow(ctx context.Context, leader string) error }
type FollowerFunc ¶
type Leader ¶
type Leader interface { // Runs when the member becomes the leader. The context is cancelled if // this node is notified a member on another node has become the leader. // Returning nil or context.Canceled should signal to a Coordinator that the // leadership was successful and the leader is stepping down cleanly. // Returning another value of error indicates some sort of failure and the // leader must step down. Lead(ctx context.Context, isLeaseAcceptable func(expiredToleration time.Duration) error) error }
type LeaderFollower ¶
type LeaderFunc ¶
type MemberGroup ¶
type MemberGroup struct {
// contains filtered or unexported fields
}
func (*MemberGroup) Add ¶
func (g *MemberGroup) Add(m Member)
type TrivialFollower ¶
type TrivialFollower struct{}
Click to show internal directories.
Click to hide internal directories.