election

package
v0.17.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module is a fx module that provides etcd based leader election per agent group.

Types

type Election

type Election struct {
	Election *concurrencyv3.Election
	// contains filtered or unexported fields
}

Election is a wrapper around etcd election.

func ProvideElection

func ProvideElection(in ElectionIn) (*Election, error)

ProvideElection provides a wrapper around etcd based leader election.

func (*Election) IsLeader

func (e *Election) IsLeader() bool

IsLeader returns true if the current node is the leader.

type ElectionIn

type ElectionIn struct {
	fx.In
	Lifecycle  fx.Lifecycle
	Shutdowner fx.Shutdowner
	Client     *etcd.Client
	AgentInfo  *agentinfo.AgentInfo
}

ElectionIn holds parameters for ProvideElection.

Jump to

Keyboard shortcuts

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