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
Click to show internal directories.
Click to hide internal directories.