leader

package
v0.0.0-...-72813be Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Winner   string
	Document string
	Timeout  time.Duration
	Wait     time.Duration
	Retry    time.Duration
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(opts ...Option) *Config

type Leader

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

func New

func New(c *Config, col *mongo.Collection) *Leader

func (*Leader) IsLeader

func (l *Leader) IsLeader() (bool, error)

func (*Leader) Start

func (l *Leader) Start()

func (*Leader) Stop

func (l *Leader) Stop()

type Logger

type Logger interface {
	zombie.Logger
}

type Option

type Option func(*Config)

func WithDocument

func WithDocument(docID string) Option

func WithLogger

func WithLogger(logger Logger) Option

func WithRetry

func WithRetry(d time.Duration) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

func WithWait

func WithWait(d time.Duration) Option

func WithWinner

func WithWinner(id string) Option

Jump to

Keyboard shortcuts

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