Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributedElectionParticipant ¶
type DistributedElectionParticipant struct {
ElectionParticipantOptions
// contains filtered or unexported fields
}
DistributedElectionParticipant implements ElectionParticipant on top of a distributed lock.
func NewElectionParticipant ¶
func NewElectionParticipant(lock dl.Lock, resourceName string, options ElectionParticipantOptions) *DistributedElectionParticipant
NewElectionParticipant returns a ElectionParticipant which attempts to become leader.
func (*DistributedElectionParticipant) Close ¶
func (p *DistributedElectionParticipant) Close() error
Close implements io.Closer.
func (*DistributedElectionParticipant) IsLeader ¶
func (p *DistributedElectionParticipant) IsLeader() bool
IsLeader returns true if this process is the leader.
func (*DistributedElectionParticipant) Start ¶
func (p *DistributedElectionParticipant) Start() error
Start runs a background thread which attempts to acquire the leader lock.
type ElectionParticipant ¶
type ElectionParticipant interface {
IsLeader() bool
}
ElectionParticipant partakes in leader election to become leader.
type ElectionParticipantOptions ¶
type ElectionParticipantOptions struct {
LeaderLeaseRefreshInterval time.Duration
FollowerLeaseRefreshInterval time.Duration
Logger *zap.Logger
}
ElectionParticipantOptions control behavior of the election participant. TODO func applyDefaults(), parameter error checking, etc.
Click to show internal directories.
Click to hide internal directories.