Documentation ¶
Index ¶
- Variables
- type RaftConsensus
- func (this *RaftConsensus) ReceiveCommited(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
- func (this *RaftConsensus) ReceiveConsensus(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
- func (this *RaftConsensus) ReceivePrepared(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
- func (this *RaftConsensus) ReceivePreprepared(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
- func (this *RaftConsensus) ReceiveReply(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MemCache = cache.NewMemCache("raft", 0, 0)
Functions ¶
This section is empty.
Types ¶
type RaftConsensus ¶
func GetRaftConsensus ¶
func GetRaftConsensus() *RaftConsensus
func (*RaftConsensus) ReceiveCommited ¶
func (this *RaftConsensus) ReceiveCommited(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
*
- follow收到commited消息,完成后,向leader发送reply消息,
- 这里与pbft的差异是不用判断,完成后reply消息发送给leader,而不是发给客户端
func (*RaftConsensus) ReceiveConsensus ¶
func (this *RaftConsensus) ReceiveConsensus(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
*
- leader 收到消息请求,向每个follow发送preprepared消息,实现与pbft一样 *
- @param chainMessage
- @return
func (*RaftConsensus) ReceivePrepared ¶
func (this *RaftConsensus) ReceivePrepared(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
* leader收到prepared消息,计算是否到达提交标准,向follow发送commited消息 与pbft的差异是只有leader能收到这种消息
func (*RaftConsensus) ReceivePreprepared ¶
func (this *RaftConsensus) ReceivePreprepared(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
* follow收到Preprepared消息,准备完成后向leader发送prepared消息
func (*RaftConsensus) ReceiveReply ¶
func (this *RaftConsensus) ReceiveReply(chainMessage *entity3.ChainMessage) (*entity3.ChainMessage, error)
* leader收到reply消息,判断完成后向客户就返回reply消息 与pbft的差异是pbft在上一步就完成了向客户端发送reply
Click to show internal directories.
Click to hide internal directories.