Documentation ¶
Index ¶
- type Consensus
- func (this *Consensus) ChooseConsensusPeer(dataBlock *entity.DataBlock) []string
- func (this *Consensus) CreateConsensusLog(chainMessage *entity2.ChainMessage, dataBlock *entity.DataBlock, ...) *entity.ConsensusLog
- func (this *Consensus) GetConsensusLog(chainMessage *entity2.ChainMessage) (*entity.ConsensusLog, error)
- func (this *Consensus) GetDataBlock(chainMessage *entity2.ChainMessage) (*entity.DataBlock, error)
- func (this *Consensus) GetDataBlockCacheKey(blockId string, sliceNumber uint64) string
- func (this *Consensus) GetLogCacheKey(log *entity.ConsensusLog) string
- func (this *Consensus) NearestConsensusPeer(key string, createTimestamp uint64) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consensus ¶
type Consensus struct {
MemCache *cache.Cache
}
func (*Consensus) ChooseConsensusPeer ¶
* 主节点挑选副节点
func (*Consensus) CreateConsensusLog ¶
func (this *Consensus) CreateConsensusLog(chainMessage *entity2.ChainMessage, dataBlock *entity.DataBlock, myselfPeer *entity1.MyselfPeer, status string) *entity.ConsensusLog
* 创建新的ConsensusLog,存入数据库中
func (*Consensus) GetConsensusLog ¶
func (this *Consensus) GetConsensusLog(chainMessage *entity2.ChainMessage) (*entity.ConsensusLog, error)
* 从消息中提取ConsensusLog
func (*Consensus) GetDataBlock ¶
* 从消息中提取datablock
func (*Consensus) GetDataBlockCacheKey ¶
* 获取datablock缓存的key
func (*Consensus) GetLogCacheKey ¶
func (this *Consensus) GetLogCacheKey(log *entity.ConsensusLog) string
* 获取日志缓存的key
Click to show internal directories.
Click to hide internal directories.