Documentation ¶
Index ¶
- func GetMsgExpirationTimeout() time.Duration
- func SetLeaderAliveThreshold(t time.Duration)
- func SetLeaderElectionDuration(t time.Duration)
- func SetMembershipSampleInterval(t time.Duration)
- func SetStartupGracePeriod(t time.Duration)
- type LeaderElectionAdapter
- type LeaderElectionService
- type Msg
- type Peer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMsgExpirationTimeout ¶
GetMsgExpirationTimeout返回领导层消息过期超时
func SetLeaderAliveThreshold ¶
setLeaderAliveThreshold配置领导者选举活动阈值
func SetLeaderElectionDuration ¶
setLeaderRelationDuration配置预期的领导层选举持续时间, 等待领导人选举完成的时间间隔
func SetMembershipSampleInterval ¶
setmembershipsampleinterval设置/初始化 membership view should be checked
func SetStartupGracePeriod ¶
setStartupGracePeriod配置启动宽限期间隔, the period of time to wait until election algorithm will start
Types ¶
type LeaderElectionAdapter ¶
type LeaderElectionAdapter interface { //流言蜚语向其他同龄人传递信息 Gossip(Msg) //accept返回发出消息的通道 Accept() <-chan Msg //创建建议消息 CreateMessage(isDeclaration bool) Msg //peers返回被认为是活动的对等方的列表 Peers() []Peer }
领导选举模块使用Lead Error适配器 发送和接收消息以及获取成员信息
func NewAdapter ¶
func NewAdapter(gossip gossip, pkiid common.PKIidType, channel common.ChainID) LeaderElectionAdapter
NewAdapter创建新的Leader Election适配器
type LeaderElectionService ¶
type LeaderElectionService interface { //Isleader返回这个同伴是否是领导者 IsLeader() bool //停止停止LeadRelationService Stop() //屈服于放弃领导直到选出新的领导, //或者超时过期 Yield() }
LeaderRelationService是运行Leader选举算法的对象
func NewLeaderElectionService ¶
func NewLeaderElectionService(adapter LeaderElectionAdapter, id string, callback leadershipCallback) LeaderElectionService
NewLeaderRelationService返回新的LeaderRelationService
Click to show internal directories.
Click to hide internal directories.