leadership

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityCriteria

type AvailabilityCriteria func() bool

type Candidate

type Candidate interface {
	Init(context.Context)
	Deinit(context.Context)
	AddAvailabilityCriteria(AvailabilityCriteria)
	TryBecomeLeader(context.Context) bool
	RenewLeadershipLease(context.Context)
	IsAvailable() bool
	IsCurrentLeader(context.Context) bool
	UpdateCandidateStatus(context.Context, bool)
	TrimCandidates(context.Context)
	GetLeaderCandidates(context.Context) []string
	SetState(context.Context, State)
	SetLeaderAndCandidateFields(context.Context)
	DoWork(context.Context)

	LosingLeadership() signalslots.Signal
	BecameLeader() signalslots.Signal
	BecameFollower() signalslots.Signal
	BecameUnavailable() signalslots.Signal

	CandidateUpdate() <-chan time.Time
	LeaderAttempt() <-chan time.Time
	LeaseRenewal() <-chan time.Time
}

type State

type State interface {
	DoWork(context.Context, Candidate)
	OnEnterState(context.Context, Candidate, State)
	Name() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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