elector

package
v0.0.0-...-2ff72f1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 8 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 New

func New(store *engine.SessionStore, key string, sessionTimeout time.Duration, runner Runner) (*Elector, error)

New is used to create an elector instance

func (*Elector) IsLeader

func (e *Elector) IsLeader() bool

IsLeader is used to check if the elector is leader

func (*Elector) Release

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

Release is used to stop the elector instance and release the session

func (*Elector) Resign

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

Resign is used to resign the leader if the elector is leader role now

func (*Elector) Run

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

Run is used to start the elector instance

func (*Elector) Wait

func (e *Elector) Wait()

type Runner

type Runner interface {
	Run(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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