leaderelection

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Close implements io.Closer.

func (*DistributedElectionParticipant) IsLeader

func (p *DistributedElectionParticipant) IsLeader() bool

IsLeader returns true if this process is the leader.

func (*DistributedElectionParticipant) Start

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL