leaderelection

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

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