Documentation ¶
Index ¶
- Constants
- func New(store data.Store) leadership.Candidate
- type Candidate
- func (c *Candidate) AddAvailabilityCriteria(criteria leadership.AvailabilityCriteria)
- func (c *Candidate) BecameFollower() signalslots.Signal
- func (c *Candidate) BecameLeader() signalslots.Signal
- func (c *Candidate) BecameUnavailable() signalslots.Signal
- func (c *Candidate) CandidateUpdate() <-chan time.Time
- func (c *Candidate) ClearLeaderAndCandidateFields(ctx context.Context)
- func (c *Candidate) Deinit(ctx context.Context)
- func (c *Candidate) DoWork(ctx context.Context)
- func (c *Candidate) GetLeaderCandidates(ctx context.Context) []string
- func (c *Candidate) Init(context.Context)
- func (c *Candidate) IsAvailable() bool
- func (c *Candidate) IsCurrentLeader(ctx context.Context) bool
- func (c *Candidate) LeaderAttempt() <-chan time.Time
- func (c *Candidate) LeaseRenewal() <-chan time.Time
- func (c *Candidate) LosingLeadership() signalslots.Signal
- func (c *Candidate) RenewLeadershipLease(ctx context.Context)
- func (c *Candidate) SetLeaderAndCandidateFields(ctx context.Context)
- func (c *Candidate) SetState(ctx context.Context, newState leadership.State)
- func (c *Candidate) TrimCandidates(ctx context.Context)
- func (c *Candidate) TryBecomeLeader(ctx context.Context) bool
- func (c *Candidate) UpdateCandidateStatus(ctx context.Context, available bool)
- type KeyGenerator
Constants ¶
View Source
const LeaseTimeout = 15 * time.Second
View Source
const MaxCandidates = 5
Variables ¶
This section is empty.
Functions ¶
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 (*Candidate) ClearLeaderAndCandidateFields ¶
func (*Candidate) GetLeaderCandidates ¶
func (*Candidate) IsAvailable ¶
func (*Candidate) LeaderAttempt ¶
func (*Candidate) LeaseRenewal ¶
func (*Candidate) LosingLeadership ¶
func (c *Candidate) LosingLeadership() signalslots.Signal
func (*Candidate) RenewLeadershipLease ¶
func (*Candidate) SetLeaderAndCandidateFields ¶
func (*Candidate) SetState ¶
func (c *Candidate) SetState(ctx context.Context, newState leadership.State)
func (*Candidate) TrimCandidates ¶
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
Click to show internal directories.
Click to hide internal directories.