leadership

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_HEARTBEAT = 60 * time.Second
View Source
const RESULT_ELECTED = "elected"

Variables

This section is empty.

Functions

This section is empty.

Types

type LeaderElection

type LeaderElection struct {
	Id      string
	Leader  Member
	Results chan string
	// contains filtered or unexported fields
}

LeaderElection provides methods for electing a leader out of eligible cluster members

func NewLeaderElection

func NewLeaderElection(props LeaderElectionProps) *LeaderElection

NewLeaderElection creates an instance of a LeaderElection struct

func (*LeaderElection) Members

func (l *LeaderElection) Members() ([]Member, error)

Members returns a list of cluster members

func (*LeaderElection) Start

func (l *LeaderElection) Start()

Start triggers a new leader election

type LeaderElectionProps added in v0.3.0

type LeaderElectionProps struct {
	HeartbeatInterval time.Duration
	StorageAdapter    storage.StorageAdapter
	AdditionalProps   map[string]any
}

LeaderElectionProps represents the properties required to instantiate new leader election

type Member

type Member struct {
	Id           string
	Registration int64
	Heartbeat    int64
}

Member represents a leadership eligible cluster node

Jump to

Keyboard shortcuts

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