Documentation ¶
Index ¶
- Constants
- type ConsensusEngine
- func (e *ConsensusEngine) Data() interface{}
- func (e *ConsensusEngine) DiscardBlocks(height uint64)
- func (e *ConsensusEngine) GetConsensusStateJSON() ([]byte, error)
- func (e *ConsensusEngine) GetLastHeight() uint64
- func (e *ConsensusEngine) GetValidators() ([]string, error)
- func (e *ConsensusEngine) HandleProposal(proposal *msgcache.PendingProposal)
- func (e *ConsensusEngine) HandleStatus()
- func (e *ConsensusEngine) ID() string
- func (e *ConsensusEngine) IsRunning() bool
- func (e *ConsensusEngine) OnMessage(message *msgbus.Message)
- func (e *ConsensusEngine) OnQuit()
- func (e *ConsensusEngine) PreBroadcaster() consistent_service.Broadcast
- func (e *ConsensusEngine) Run()
- func (e *ConsensusEngine) Start() error
- func (e *ConsensusEngine) StartEngine() error
- func (e *ConsensusEngine) Statuses() map[int8]consistent_service.Status
- func (e *ConsensusEngine) Stop() error
- func (e *ConsensusEngine) StopEngine() error
- func (e *ConsensusEngine) SwitchEpoch(contract *maxbft.GovernanceContract)
- func (e *ConsensusEngine) SwitchState(contract *maxbft.GovernanceContract) error
- func (e *ConsensusEngine) TimePattern() interface{}
- func (e *ConsensusEngine) TriggerNewEpoch() error
- func (e *ConsensusEngine) Type() int8
- func (e *ConsensusEngine) Update(remoteStatus consistent_service.Status)
- func (e *ConsensusEngine) UpdateStatus(status consistent_service.Status)
- func (e *ConsensusEngine) Verify(consensusType consensus.ConsensusType, chainConfig *config.ChainConfig) error
- type Decoder
- type Event
- type EventType
- type RemoteNodeInfo
- type RemotePeerStatus
- type StartSyncService
- type Transceiver
Constants ¶
const ( // MAXBFT_LOCAL_NODE_STATUS defines local node status of the consistent engine MAXBFT_LOCAL_NODE_STATUS = iota // MAXBFT_REMOTE_NODE_STATUS defines remote node status of the consistent engine MAXBFT_REMOTE_NODE_STATUS )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsensusEngine ¶
type ConsensusEngine struct {
// contains filtered or unexported fields
}
ConsensusEngine implements a MaxBft consensus engine
func NewEngine ¶
func NewEngine(cfg *consensusUtils.ConsensusImplConfig, epochState *maxbft.GovernanceContract, hasReplayed bool) (*ConsensusEngine, error)
NewEngine create consensus engine
func (*ConsensusEngine) Data ¶
func (e *ConsensusEngine) Data() interface{}
Data Return the status of the local node
func (*ConsensusEngine) DiscardBlocks ¶
func (e *ConsensusEngine) DiscardBlocks(height uint64)
DiscardBlocks discards blocks in the cache of core engine module
func (*ConsensusEngine) GetConsensusStateJSON ¶
func (e *ConsensusEngine) GetConsensusStateJSON() ([]byte, error)
GetConsensusStateJSON get consensus state
func (*ConsensusEngine) GetLastHeight ¶
func (e *ConsensusEngine) GetLastHeight() uint64
GetLastHeight get latest consensus height
func (*ConsensusEngine) GetValidators ¶
func (e *ConsensusEngine) GetValidators() ([]string, error)
GetValidators get validators
func (*ConsensusEngine) HandleProposal ¶
func (e *ConsensusEngine) HandleProposal(proposal *msgcache.PendingProposal)
HandleProposal Processing proposal from msgcache component
func (*ConsensusEngine) HandleStatus ¶
func (e *ConsensusEngine) HandleStatus()
HandleStatus Update local state with information received from other nodes
func (*ConsensusEngine) ID ¶
func (e *ConsensusEngine) ID() string
ID Identifies the node ID in the consistent service
func (*ConsensusEngine) IsRunning ¶
func (e *ConsensusEngine) IsRunning() bool
IsRunning Indicates whether the status broadcast service is running
func (*ConsensusEngine) OnMessage ¶
func (e *ConsensusEngine) OnMessage(message *msgbus.Message)
OnMessage process message from msgBus
func (*ConsensusEngine) PreBroadcaster ¶
func (e *ConsensusEngine) PreBroadcaster() consistent_service.Broadcast
PreBroadcaster Preprocessing of a node's broadcast message, returning data to be broadcast
func (*ConsensusEngine) Run ¶
func (e *ConsensusEngine) Run()
Run The status broadcast service is started
func (*ConsensusEngine) Start ¶
func (e *ConsensusEngine) Start() error
Start implement the Start function of interface StatusBroadcaster
func (*ConsensusEngine) StartEngine ¶
func (e *ConsensusEngine) StartEngine() error
StartEngine starts the local consensus engine
func (*ConsensusEngine) Statuses ¶
func (e *ConsensusEngine) Statuses() map[int8]consistent_service.Status
Statuses implements Statuses of the Node interface in consistent engine for the local node
func (*ConsensusEngine) Stop ¶
func (e *ConsensusEngine) Stop() error
Stop implement the Stop function of interface StatusBroadcaster
func (*ConsensusEngine) StopEngine ¶
func (e *ConsensusEngine) StopEngine() error
StopEngine stops the local consensus engine
func (*ConsensusEngine) SwitchEpoch ¶
func (e *ConsensusEngine) SwitchEpoch(contract *maxbft.GovernanceContract)
SwitchEpoch fired msg to switch epoch
func (*ConsensusEngine) SwitchState ¶
func (e *ConsensusEngine) SwitchState(contract *maxbft.GovernanceContract) error
SwitchState After the epoch switch is successful, the status of consensus engine is updated to the new epoch and the part of data of the old epoch is clear.
func (*ConsensusEngine) TimePattern ¶
func (e *ConsensusEngine) TimePattern() interface{}
TimePattern The timing set in the consistent service
func (*ConsensusEngine) TriggerNewEpoch ¶
func (e *ConsensusEngine) TriggerNewEpoch() error
TriggerNewEpoch Launch the new epoch 当存在连续几个块都为世代切换配置块(如:实时配置变更模式),且节点共识引擎已经启动的 情况下,在处理区块提交信息过程中使用链上的最新状态更新完引擎的各组件后,调用该方法 触发节点在新世代共识流程继续运行
func (*ConsensusEngine) Type ¶
func (e *ConsensusEngine) Type() int8
Type Returns the type of node status
func (*ConsensusEngine) Update ¶
func (e *ConsensusEngine) Update(remoteStatus consistent_service.Status)
Update local node status with remote node information
func (*ConsensusEngine) UpdateStatus ¶
func (e *ConsensusEngine) UpdateStatus(status consistent_service.Status)
UpdateStatus implements UpdateStatus of the Node interface in consistent engine for the local node
func (*ConsensusEngine) Verify ¶
func (e *ConsensusEngine) Verify(consensusType consensus.ConsensusType, chainConfig *config.ChainConfig) error
Verify Implement verification interface for configuration changes
type Decoder ¶
type Decoder struct { }
Decoder implements Decoder interface in consistent engine
type RemoteNodeInfo ¶
type RemoteNodeInfo struct { *RemotePeerStatus // contains filtered or unexported fields }
RemoteNodeInfo implements the Node interface in consistent engine, and to describe the status of the remote nodes
func NewRemoteInfo ¶
func NewRemoteInfo(msg *maxbft.NodeStatus, local *ConsensusEngine) *RemoteNodeInfo
NewRemoteInfo initials and returns a RemoteNodeInfo object
func (*RemoteNodeInfo) ID ¶
func (r *RemoteNodeInfo) ID() string
ID returns the node Id of the remote node
func (*RemoteNodeInfo) Statuses ¶
func (r *RemoteNodeInfo) Statuses() map[int8]consistent_service.Status
Statuses implements Statuses of the Node interface in consistent engine for a remote node
func (*RemoteNodeInfo) UpdateStatus ¶
func (r *RemoteNodeInfo) UpdateStatus(status consistent_service.Status)
UpdateStatus implements UpdateStatus of the Node interface in consistent engine for a remote node
type RemotePeerStatus ¶
type RemotePeerStatus struct { *maxbft.NodeStatus // contains filtered or unexported fields }
RemotePeerStatus defines remote peer status, implements Status interface of the consistent engine
func NewRemotePeer ¶
func NewRemotePeer(msg *maxbft.NodeStatus, local *ConsensusEngine) *RemotePeerStatus
NewRemotePeer initials and returns a RemotePeerStatus object
func (*RemotePeerStatus) Data ¶
func (r *RemotePeerStatus) Data() interface{}
Data returns the status data
func (*RemotePeerStatus) Type ¶
func (r *RemotePeerStatus) Type() int8
Type returns the remote node status of the consistent engine
func (*RemotePeerStatus) Update ¶
func (r *RemotePeerStatus) Update(nodeStatus consistent_service.Status)
Update updates local status by the specified node status
type StartSyncService ¶
type StartSyncService struct {
// contains filtered or unexported fields
}
StartSyncService start sync service
func NewStartSyncService ¶
func NewStartSyncService(nodeId string, epochId uint64) *StartSyncService
NewStartSyncService init
type Transceiver ¶
type Transceiver struct { msgbus.MessageBus // contains filtered or unexported fields }
Transceiver implements Message interface of the consistent engine
func NewTransceiver ¶
func NewTransceiver(msgBus msgbus.MessageBus, receiver chan *net.NetMsg) *Transceiver
NewTransceiver initials and returns a Transceiver object
func (*Transceiver) Receive ¶
func (t *Transceiver) Receive() interface{}
Receive consistent messages from other consensus nodes
func (*Transceiver) Send ¶
func (t *Transceiver) Send(payload interface{})
Send sends consistent messages to other consensus nodes