Documentation ¶
Index ¶
Constants ¶
View Source
const ( // StateFollower defines currentState of backup-restore as "Follower". StateFollower = "Follower" // StateCandidate defines currentState of backup-restore as "Candidate". StateCandidate = "Candidate" // StateLeader defines currentState of backup-restore as "Leader". StateLeader = "Leader" // StateUnknown defines currentState of backup-restore as "UnknownState". StateUnknown = "UnknownState" // DefaultCurrentState defines default currentState of backup-restore as "Follower". DefaultCurrentState = StateFollower // NoLeaderState defines the state when etcd returns LeaderID as 0. NoLeaderState uint64 = 0 )
Variables ¶
This section is empty.
Functions ¶
func EtcdMemberStatus ¶
func EtcdMemberStatus(ctx context.Context, etcdConnectionConfig *brtypes.EtcdConnectionConfig, etcdConnectionTimeout time.Duration, logger *logrus.Entry) (bool, bool, error)
EtcdMemberStatus checks whether the current instance of backup-restore is leader or not. It also returns the boolean indicating the presence of learner(non-voting) member.
Types ¶
type LeaderElector ¶
type LeaderElector struct { // CurrentState defines currentState of backup-restore for LeaderElection. CurrentState string Config *brtypes.Config EtcdConnectionConfig *brtypes.EtcdConnectionConfig Callbacks *brtypes.LeaderCallbacks LeaseCallbacks *brtypes.MemberLeaseCallbacks PromoteCallback *brtypes.PromoteLearnerCallback CheckMemberStatus brtypes.EtcdMemberStatusCallbackFunc // contains filtered or unexported fields }
LeaderElector holds the all configuration necessary to elect backup-restore Leader.
func NewLeaderElector ¶
func NewLeaderElector(logger *logrus.Entry, etcdConnectionConfig *brtypes.EtcdConnectionConfig, leaderElectionConfig *brtypes.Config, callbacks *brtypes.LeaderCallbacks, memberLeaseCallbacks *brtypes.MemberLeaseCallbacks, memberStatusFunc brtypes.EtcdMemberStatusCallbackFunc, promoteCallback *brtypes.PromoteLearnerCallback) (*LeaderElector, error)
NewLeaderElector returns LeaderElector configurations.
Click to show internal directories.
Click to hide internal directories.