candidate

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const LeaseTimeout = 15 * time.Second
View Source
const MaxCandidates = 5

Variables

This section is empty.

Functions

func New

func New(store data.Store) leadership.Candidate

Types

type Candidate

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

func (*Candidate) AddAvailabilityCriteria

func (c *Candidate) AddAvailabilityCriteria(criteria leadership.AvailabilityCriteria)

func (*Candidate) BecameFollower

func (c *Candidate) BecameFollower() signalslots.Signal

func (*Candidate) BecameLeader

func (c *Candidate) BecameLeader() signalslots.Signal

func (*Candidate) BecameUnavailable

func (c *Candidate) BecameUnavailable() signalslots.Signal

func (*Candidate) CandidateUpdate

func (c *Candidate) CandidateUpdate() <-chan time.Time

func (*Candidate) ClearLeaderAndCandidateFields

func (c *Candidate) ClearLeaderAndCandidateFields(ctx context.Context)

func (*Candidate) Deinit

func (c *Candidate) Deinit(ctx context.Context)

func (*Candidate) DoWork

func (c *Candidate) DoWork(ctx context.Context)

func (*Candidate) GetLeaderCandidates

func (c *Candidate) GetLeaderCandidates(ctx context.Context) []string

func (*Candidate) Init

func (c *Candidate) Init(context.Context)

func (*Candidate) IsAvailable

func (c *Candidate) IsAvailable() bool

func (*Candidate) IsCurrentLeader

func (c *Candidate) IsCurrentLeader(ctx context.Context) bool

func (*Candidate) LeaderAttempt

func (c *Candidate) LeaderAttempt() <-chan time.Time

func (*Candidate) LeaseRenewal

func (c *Candidate) LeaseRenewal() <-chan time.Time

func (*Candidate) LosingLeadership

func (c *Candidate) LosingLeadership() signalslots.Signal

func (*Candidate) RenewLeadershipLease

func (c *Candidate) RenewLeadershipLease(ctx context.Context)

func (*Candidate) SetLeaderAndCandidateFields

func (c *Candidate) SetLeaderAndCandidateFields(ctx context.Context)

func (*Candidate) SetState

func (c *Candidate) SetState(ctx context.Context, newState leadership.State)

func (*Candidate) TrimCandidates

func (c *Candidate) TrimCandidates(ctx context.Context)

func (*Candidate) TryBecomeLeader

func (c *Candidate) TryBecomeLeader(ctx context.Context) bool

func (*Candidate) UpdateCandidateStatus

func (c *Candidate) UpdateCandidateStatus(ctx context.Context, available bool)

type KeyGenerator

type KeyGenerator struct{}

leader:<appName>:current leader:<appName>:candidates

func (*KeyGenerator) GetLeaderCandidatesKey

func (g *KeyGenerator) GetLeaderCandidatesKey(app string) string

func (*KeyGenerator) GetLeaderKey

func (g *KeyGenerator) GetLeaderKey(app string) string

Jump to

Keyboard shortcuts

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