election

package
v1.1.17-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Election

type Election struct {
	RoleCh chan role.Role
	// contains filtered or unexported fields
}

Election for leader node election

func New

func New(opts ...Option) (e *Election)

New returns a new Election

func (*Election) Run

func (e *Election) Run(ctx context.Context, ch chan role.Role)

Run start election process

func (*Election) Stopped added in v1.1.3

func (e *Election) Stopped() chan struct{}

type Manager added in v1.1.3

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

Manager is election cycle manager

func NewManager added in v1.1.3

func NewManager(optNode *node.Node) (m *Manager)

NewManager returns a new manager

func (*Manager) RoleCh added in v1.1.3

func (m *Manager) RoleCh() chan role.Role

RoleCh return role chan

func (*Manager) Run added in v1.1.3

func (m *Manager) Run(ctx context.Context)

Run election cycle

func (*Manager) Stopped added in v1.1.3

func (m *Manager) Stopped() chan struct{}

type Option

type Option func(e *Election)

Option is function of set election

func OptionNode

func OptionNode(node *node.Node) Option

OptionNode sets election node

func OptionTTL

func OptionTTL(ttl int) Option

OptionTTL sets election ttl

Jump to

Keyboard shortcuts

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