leadership

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elector

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

func NewElector

func NewElector(adapter dbadapter.Adapter, notifier *notifier.Notifier, name, id string, interval time.Duration) (*Elector, error)

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) Run

func (e *Elector) Run(ctx context.Context)

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