msgcache

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedMsgTransmitter

type CachedMsgTransmitter struct {
	sync.RWMutex // 读写锁,用户后续有查询需求
	// contains filtered or unexported fields
}

CachedMsgTransmitter defines a message transmitter between forest and consensus engine

func NewMsgCacheHandler

func NewMsgCacheHandler(
	cachedForest forest.Forester,
	proposalHandler Handler,
	reqCompensator compensator.RequestCompensator,
	logger protocol.Logger,
) *CachedMsgTransmitter

NewMsgCacheHandler initials and returns a new CachedMsgTransmitter object

func (*CachedMsgTransmitter) AddEventFn

func (h *CachedMsgTransmitter) AddEventFn() forest.AddedEventFunc

AddEventFn 当触发添加事件时的处理流程 核心处理是判断是否有串联需要处理的提案,如有则处理,用作一种补偿机制

func (*CachedMsgTransmitter) FinalEventFn

func (h *CachedMsgTransmitter) FinalEventFn() forest.FinalEventFunc

FinalEventFn 当产生final事件时的回调函数

func (*CachedMsgTransmitter) FinalView

func (h *CachedMsgTransmitter) FinalView() uint64

FinalView returns the finalView of the transmitter

func (*CachedMsgTransmitter) HandleProposal

func (h *CachedMsgTransmitter) HandleProposal(proposal *PendingProposal) error

HandleProposal 处理proposal,会默认进行一次视图判断

func (*CachedMsgTransmitter) SetForest

func (h *CachedMsgTransmitter) SetForest(fork forest.Forester)

SetForest sets the forest of the msgCache

func (*CachedMsgTransmitter) Start

func (h *CachedMsgTransmitter) Start()

Start 启动后台处理提案服务

func (*CachedMsgTransmitter) Stop

func (h *CachedMsgTransmitter) Stop() error

Stop stops the transmitter

type ForestNodes

type ForestNodes struct {
	// contains filtered or unexported fields
}

ForestNodes 节点集合,用于存储节点map

func NewForestNodes

func NewForestNodes() *ForestNodes

NewForestNodes returns a new ForestNodes object

func (*ForestNodes) AddNode

func (ns *ForestNodes) AddNode(node *forest.CachedForestNode)

AddNode adds a node to ForestNodes

func (*ForestNodes) AllNodes

func (ns *ForestNodes) AllNodes() map[string]*forest.CachedForestNode

AllNodes returns all nodes

func (*ForestNodes) DelNode

func (ns *ForestNodes) DelNode(key string)

DelNode deletes a node with the specified key from nodes

func (ForestNodes) ExistNode

func (ns ForestNodes) ExistNode(key string) bool

ExistNode check a node with specified key was exist or not

func (*ForestNodes) GetNode

func (ns *ForestNodes) GetNode(key string) *forest.CachedForestNode

GetNode finds a node by the specified key and returns it

func (*ForestNodes) GetNodesByParentKey

func (ns *ForestNodes) GetNodesByParentKey(parentKey string) []*forest.CachedForestNode

GetNodesByParentKey gets nodes by parent key

type Handler

type Handler interface {
	HandleProposal(*PendingProposal)
}

Handler The component that handles the proposal

type MissingProposal

type MissingProposal struct {
	BlockHeight uint64
	View        uint64
	BlockId     string
}

MissingProposal 缺失的提案信息

func NewMissingProposal

func NewMissingProposal(height, view uint64, hash string) *MissingProposal

NewMissingProposal initials and returns a new MissingProposal object

type MsgTransmitter

type MsgTransmitter interface {
	// HandleProposal 处理提案数据
	HandleProposal(proposal *PendingProposal) error

	// Stop 释放资源
	Stop() error

	// Start 启动服务
	Start()

	SetForest(forester forest.Forester)
}

MsgTransmitter defines a transmitter used to transmit message between consensus engine and forest

type PendingProposal

type PendingProposal struct {
	// FromOtherNodes marks that the proposal is from other nodes' responses or not
	FromOtherNodes bool

	// Proposal is the raw proposal
	Proposal *maxbft.ProposalData

	// Sender indicates witch node the proposal is from
	Sender string

	// Qc is the qc of the proposal
	Qc *maxbft.QuorumCert
}

PendingProposal packages the maxbft.ProposalData

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL