Versions in this module Expand all Collapse all v1 v1.19.1 Oct 25, 2022 Changes in this version + type ActionType int + const ActionTypeMakeLeader + const ActionTypeMakeNobody + const ActionTypeMakeSlave + type LeaderCallbacks struct + OnStartedLeading func(stop <-chan struct{}) + OnStoppedLeading func() + type LeaderElector struct + StopChan chan struct{} + func NewLeaderElector(nreg *register.NodeRegister, callbacks *LeaderCallbacks) *LeaderElector + func (le *LeaderElector) IsLeader() bool + func (le *LeaderElector) Run() + func (le *LeaderElector) SetRole(role Role) + type LeaderState struct + func (s LeaderState) OnMakeLeader(elector *LeaderElector) + func (s LeaderState) OnMakeNobody(elector *LeaderElector) + func (s LeaderState) OnMakeSlave(elector *LeaderElector) + type NobodyState struct + func (s NobodyState) OnMakeLeader(elector *LeaderElector) + func (s NobodyState) OnMakeNobody(elector *LeaderElector) + func (s NobodyState) OnMakeSlave(elector *LeaderElector) + type Role int + const RoleLeader + const RoleNobody + const RoleSlave + type RoleState interface + OnMakeLeader func(elector *LeaderElector) + OnMakeNobody func(elector *LeaderElector) + OnMakeSlave func(elector *LeaderElector) + func NewRoleState(role Role) RoleState + type ServiceNode struct + Id string + Info types.ServerInfo + func NewServiceNode(info types.ServerInfo) ServiceNode + func (n *ServiceNode) OwnsPayload(payload []byte) bool + func (n *ServiceNode) Payload() []byte + func (n *ServiceNode) PrimaryKey() string + type SlaveState struct + func (s SlaveState) OnMakeLeader(elector *LeaderElector) + func (s SlaveState) OnMakeNobody(elector *LeaderElector) + func (s SlaveState) OnMakeSlave(elector *LeaderElector)