Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EtcdLeaderElection ¶
type EtcdLeaderElection struct { LeaderElectionConfig // contains filtered or unexported fields }
func New ¶
func New(config LeaderElectionConfig) (*EtcdLeaderElection, error)
func (*EtcdLeaderElection) Close ¶
func (le *EtcdLeaderElection) Close() error
type LeaderCallbacks ¶
type LeaderCallbacks struct { // OnStartedLeading is called when a LeaderElector client starts leading OnStartedLeading func(context.Context) // OnStoppedLeading is called when a LeaderElector client stops leading OnStoppedLeading func() // OnNewLeader is called when the client observes a leader that is // not the previously observed leader. This includes the first observed // leader when the client starts. OnNewLeader func(identity string) }
type LeaderElectionConfig ¶
type LeaderElectionConfig struct { // Lock is the resource that will be used for locking Client *clientv3.Client // LeaseDuration is the duration that non-leader candidates will // wait to force acquire leadership. This is measured against time of // last observed ack. // // A client needs to wait a full LeaseDuration without observing a change to // the record before it can attempt to take over. When all clients are // shutdown and a new set of clients are started with different names against // the same leader record, they must wait the full LeaseDuration before // attempting to acquire the lease. Thus LeaseDuration should be as short as // possible (within your tolerance for clock skew rate) to avoid a possible // long waits in the scenario. // // Core clients default this value to 15 seconds. LeaseSeconds int // Callbacks are callbacks that are triggered during certain lifecycle // events of the LeaderElector Callbacks LeaderCallbacks Prefix string Identity string }
Click to show internal directories.
Click to hide internal directories.