Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIdentity ¶
Types ¶
type ElectionConfig ¶
type ElectionConfig struct {
// The name of the component
Id string
// The namespace where the component is running
Namespace string
// Callback function that is executed when the current component becomes leader
OnStartedLeading func(c context.Context)
// Callback function that is executed when the current component stops leading
OnStoppedLeading func()
// Callback function that is executed when a new leader is elected
OnNewLeader func(leaderId string)
}
ElectionConfig is the set of properties that can be used to configure leader elections
type ElectionFactory ¶
type ElectionFactory interface {
// StartElection begins leader election and returns the Identity of the current component
StartElection(ctx context.Context, config *ElectionConfig) (Identity, error)
}
An ElectionFactory is an implementation for running a leader election
Click to show internal directories.
Click to hide internal directories.