Version: v0.3.0 Latest Latest

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 6 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Tracker

type Tracker struct {
	// contains filtered or unexported fields

Tracker tracks mastership of a collection of resources.

func NewTracker

func NewTracker(factory election2.Factory, maxHold time.Duration, metricFactory monitoring.MetricFactory) *Tracker

NewTracker returns a new mastership tracker.

func (*Tracker) AddResource

func (mt *Tracker) AddResource(res string)

AddResource makes the mastership tracker aware of new resources. The same resource may be added an unlimited number of times.

func (*Tracker) Masterships

func (mt *Tracker) Masterships(ctx context.Context) (map[string]context.Context, error)

Masterships returns a map of resources to mastership contexts. Callers should cancel ctx when they no longer are actively using mastership. If Masterships is not called periodically, we may retain masterships for longer than maxHold.

func (*Tracker) Run

func (mt *Tracker) Run(ctx context.Context)

Run starts new watchers for new resources.

Source Files

Jump to

Keyboard shortcuts

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