leadership

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Leadership

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

Leadership manages the leadership for this replica. It will elect and re-elect leadership, returning contexts which cancel on lost quorum.

func New

func New(opts Options) *Leadership

func (*Leadership) Elect added in v0.4.0

Elect will elect this replica as the leader. It will return a context which will cancel when the leadership quorum is lost.

func (*Leadership) Reelect added in v0.4.0

Reelect will re-elect this replica as the leader. It will return a context which will cancel when the leadership quorum is lost. Should be called after initial election quorum is lost.

func (*Leadership) Run

func (l *Leadership) Run(ctx context.Context) error

type Options

type Options struct {
	// Log is the logger for the leadership.
	Log logr.Logger

	// Client is the etcd client.
	Client client.Interface

	// Key is the ETCD key generator.
	Key *key.Key

	// ReplicaData is the replicaData for the instance using the cron library.
	// This will contain data like host + port for keeping track of active replicas.
	ReplicaData *anypb.Any
}

Options are the options for the Leadership.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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