leadership

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 2 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()
	Deinit()
	AddAvailabilityCriteria(AvailabilityCriteria)
	TryBecomeLeader() bool
	RenewLeadershipLease()
	IsAvailable() bool
	IsCurrentLeader() bool
	UpdateCandidateStatus(bool)
	TrimCandidates()
	GetLeaderCandidates() []string
	SetState(State)
	SetLeaderAndCandidateFields()
	DoWork()

	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(Candidate)
	OnEnterState(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