cluster

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EtcdLeaderElector is the id used when constructing an
	// etcdLeaderElector instance through the factory.
	EtcdLeaderElector = "etcd"
)
View Source
const Subsystem = "CLUS"

Subsystem defines the logging code for this subsystem.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all logging output.

func RegisterLeaderElectorFactory

func RegisterLeaderElectorFactory(id string, factory leaderElectorFactoryFunc)

RegisterLeaderElectorFactory will register a new LeaderElector factory method corresponding to the passed id.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type LeaderElector

type LeaderElector interface {
	// Campaign starts a run for leadership. Campaign will block until
	// the caller is elected as the leader.
	Campaign(ctx context.Context) error

	// Resign resigns from the leader role, allowing other election members
	// to take on leadership.
	Resign() error

	// Leader returns the leader value for the current election.
	Leader(ctx context.Context) (string, error)
}

LeaderElector is a general interface implementing basic leader elections in a clustered environment.

func MakeLeaderElector

func MakeLeaderElector(ctx context.Context, id string, args ...interface{}) (
	LeaderElector, error)

MakeLeaderElector will construct a LeaderElector identified by id with the passed arguments.

Jump to

Keyboard shortcuts

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