leader

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package leader provides leader election

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElectOption

type ElectOption func(o *ElectOptions)

type ElectOptions

type ElectOptions struct{}

type Elected

type Elected interface {
	// id of leader
	Id() string
	// seek re-election
	Reelect() error
	// resign leadership
	Resign() error
	// observe leadership revocation
	Revoked() chan bool
}

type Leader

type Leader interface {
	// elect leader
	Elect(id string, opts ...ElectOption) (Elected, error)
	// follow the leader
	Follow() chan string
}

Leader provides leadership election

type Option

type Option func(o *Options)

func Group

func Group(g string) Option

Group sets the group name for coordinating leadership

func Nodes

func Nodes(a ...string) Option

Nodes sets the addresses of the underlying systems

type Options

type Options struct {
	Nodes []string
	Group string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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