election

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Context       context.Context
	Identity      string
	LockNamespace string
	LockName      string

	LeaseDuration time.Duration
	RenewDeadline time.Duration
	RetryPeriod   time.Duration
}

Config defines a generic configuration for managing leader election.

type Leader

type Leader struct {
	// contains filtered or unexported fields
}

Leader encapsulates logic for tracking the current leader.

func NewLeader

func NewLeader() *Leader

NewLeader constructs a leader to be used along with a proxy.Server.

func (*Leader) Get

func (l *Leader) Get() (string, context.Context, bool)

Get returns the current leader and their corresponding context.

func (*Leader) Update

func (l *Leader) Update(leader string)

Update cancels the current context, then sets a new leader and context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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