leadership

package
v0.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.3.0

type Config struct {
	ClientID            string
	ElectInterval       time.Duration // period on which each elector attempts elect even without having received a resignation notification
	ElectIntervalJitter time.Duration
}

type Elector

type Elector struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

func NewElector

func NewElector(archetype *baseservice.Archetype, exec riverdriver.Executor, notifier *notifier.Notifier, config *Config) *Elector

NewElector returns an Elector using the given adapter. The name should correspond to the name of the database + schema combo and should be shared across all Clients running with that combination. The id should be unique to the Client.

func (*Elector) Listen

func (e *Elector) Listen() *Subscription

func (*Elector) Start added in v0.1.0

func (e *Elector) Start(ctx context.Context) error

type Notification

type Notification struct {
	IsLeader  bool
	Timestamp time.Time
}

type Subscription

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

func (*Subscription) C

func (s *Subscription) C() <-chan *Notification

func (*Subscription) Unlisten

func (s *Subscription) Unlisten()

Jump to

Keyboard shortcuts

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