Documentation ¶
Index ¶
- Variables
- func VerifyBlockSignatures(block *common.Block) error
- type AdditionalData
- type ConsensusRaftImpl
- func (consensus *ConsensusRaftImpl) AsyncWalSave()
- func (consensus *ConsensusRaftImpl) GetConsensusStateJSON() ([]byte, error)
- func (consensus *ConsensusRaftImpl) GetLastHeight() uint64
- func (consensus *ConsensusRaftImpl) GetValidators() ([]string, error)
- func (consensus *ConsensusRaftImpl) NodeReady(ready etcdraft.Ready) (exit bool)
- func (consensus *ConsensusRaftImpl) OnMessage(message *msgbus.Message)
- func (consensus *ConsensusRaftImpl) OnQuit()
- func (consensus *ConsensusRaftImpl) ProposeBlock(block *common.Block)
- func (consensus *ConsensusRaftImpl) PurgeFile(dirname string)
- func (consensus *ConsensusRaftImpl) Start() error
- func (consensus *ConsensusRaftImpl) Stop() error
- func (consensus *ConsensusRaftImpl) Verify(consensusType consensuspb.ConsensusType, chainConfig *config.ChainConfig) error
- type ConsensusRaftImplConfig
- type Logger
- type SnapshotArgs
- type SnapshotHeight
Constants ¶
This section is empty.
Variables ¶
var ( DefaultChanCap = 1000 RAFTAddtionalDataKey = "RAFTAddtionalDataKey" )
Functions ¶
func VerifyBlockSignatures ¶
VerifyBlockSignatures verifies whether the signatures in block is qulified with the consensus algorithm. It should return nil error when verify successfully, and return corresponding error when failed.
Types ¶
type AdditionalData ¶
type AdditionalData struct {
Signature []byte
}
AdditionalData contains consensus specified data to be store in block
type ConsensusRaftImpl ¶
ConsensusRaftImpl is the implementation of Raft algorithm and it implements the ConsensusEngine interface.
func New ¶
func New(config *consensusUtils.ConsensusImplConfig) (*ConsensusRaftImpl, error)
New creates a raft consensus instance
func (*ConsensusRaftImpl) AsyncWalSave ¶
func (consensus *ConsensusRaftImpl) AsyncWalSave()
func (*ConsensusRaftImpl) GetConsensusStateJSON ¶
func (consensus *ConsensusRaftImpl) GetConsensusStateJSON() ([]byte, error)
func (*ConsensusRaftImpl) GetLastHeight ¶
func (consensus *ConsensusRaftImpl) GetLastHeight() uint64
func (*ConsensusRaftImpl) GetValidators ¶
func (consensus *ConsensusRaftImpl) GetValidators() ([]string, error)
func (*ConsensusRaftImpl) NodeReady ¶
func (consensus *ConsensusRaftImpl) NodeReady(ready etcdraft.Ready) (exit bool)
func (*ConsensusRaftImpl) OnMessage ¶
func (consensus *ConsensusRaftImpl) OnMessage(message *msgbus.Message)
OnMessage receives messages from msgbus
func (*ConsensusRaftImpl) OnQuit ¶
func (consensus *ConsensusRaftImpl) OnQuit()
func (*ConsensusRaftImpl) ProposeBlock ¶
func (consensus *ConsensusRaftImpl) ProposeBlock(block *common.Block)
func (*ConsensusRaftImpl) PurgeFile ¶
func (consensus *ConsensusRaftImpl) PurgeFile(dirname string)
func (*ConsensusRaftImpl) Start ¶
func (consensus *ConsensusRaftImpl) Start() error
Start starts the raft instance
func (*ConsensusRaftImpl) Stop ¶
func (consensus *ConsensusRaftImpl) Stop() error
Start stops the raft instance
func (*ConsensusRaftImpl) Verify ¶
func (consensus *ConsensusRaftImpl) Verify( consensusType consensuspb.ConsensusType, chainConfig *config.ChainConfig) error
Verify implements interface of struct Verifier, This interface is used to verify the validity of parameters, it executes before consensus.
type ConsensusRaftImplConfig ¶
type ConsensusRaftImplConfig struct { ChainID string NodeId string Singer protocol.SigningMember Ac protocol.AccessControlProvider LedgerCache protocol.LedgerCache BlockVerifier protocol.BlockVerifier BlockCommitter protocol.BlockCommitter ChainConf protocol.ChainConf MsgBus msgbus.MessageBus }
ConsensusRaftImplConfig contains initialization config for ConsensusRaftImpl
type Logger ¶
type Logger struct { *zap.SugaredLogger // contains filtered or unexported fields }
Logger implements raft.Logger interface with wraping zap.SugaredLogger
func NewLogger ¶
func NewLogger(lg *zap.SugaredLogger) *Logger
NewLogger creates a new Logger instance
type SnapshotArgs ¶
type SnapshotHeight ¶
type SnapshotHeight struct {
Height uint64
}
SnapshotHeight stores block height in raft snapshot.