Documentation ¶
Index ¶
- Variables
- type Broadcast
- type BroadcastCB
- type ConsensusDoneCB
- type ConsensusMetrics
- type CreateBlockCB
- type Noop
- func (n *Noop) Activate(_ bool)
- func (n *Noop) Active() bool
- func (n *Noop) Calibrate(uint64)
- func (n *Noop) HandleConsensusMsg(*iotextypes.ConsensusMessage) error
- func (n *Noop) Metrics() (ConsensusMetrics, error)
- func (n *Noop) Start(_ context.Context) error
- func (n *Noop) Stop(_ context.Context) error
- func (n *Noop) ValidateBlockFooter(*block.Block) error
- type Scheme
- type Standalone
- func (s *Standalone) Activate(_ bool)
- func (s *Standalone) Active() bool
- func (s *Standalone) Calibrate(uint64)
- func (s *Standalone) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error
- func (s *Standalone) Metrics() (ConsensusMetrics, error)
- func (s *Standalone) Start(ctx context.Context) error
- func (s *Standalone) Stop(ctx context.Context) error
- func (s *Standalone) ValidateBlockFooter(*block.Block) error
- type TellPeerCB
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented indicates the method is not implemented yet ErrNotImplemented = errors.New("not implemented") )
Functions ¶
This section is empty.
Types ¶
type BroadcastCB ¶
BroadcastCB defines the callback to publish the consensus result
type ConsensusDoneCB ¶
ConsensusDoneCB defines the callback when consensus is reached
type ConsensusMetrics ¶
type ConsensusMetrics struct { LatestEpoch uint64 LatestHeight uint64 LatestDelegates []string LatestBlockProducer string }
ConsensusMetrics contains consensus metrics to expose
type CreateBlockCB ¶
CreateBlockCB defines the callback to create a new block
type Noop ¶
type Noop struct { }
Noop is the consensus scheme that does NOT create blocks
func (*Noop) HandleConsensusMsg ¶
func (n *Noop) HandleConsensusMsg(*iotextypes.ConsensusMessage) error
HandleConsensusMsg handles incoming consensus message
func (*Noop) Metrics ¶
func (n *Noop) Metrics() (ConsensusMetrics, error)
Metrics is not implemented for noop scheme
type Scheme ¶
type Scheme interface { lifecycle.StartStopper HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error Calibrate(uint64) Metrics() (ConsensusMetrics, error) Activate(bool) Active() bool }
Scheme is the interface that consensus schemes should implement
func NewStandalone ¶
func NewStandalone(create CreateBlockCB, commit ConsensusDoneCB, pub BroadcastCB, bc blockchain.Blockchain, interval time.Duration) Scheme
NewStandalone creates a Standalone struct.
type Standalone ¶
type Standalone struct {
// contains filtered or unexported fields
}
Standalone is the consensus scheme that periodically create blocks
func (*Standalone) Activate ¶
func (s *Standalone) Activate(_ bool)
Activate is not implemented for standalone scheme
func (*Standalone) Active ¶
func (s *Standalone) Active() bool
Active is always true for standalone scheme
func (*Standalone) Calibrate ¶
func (s *Standalone) Calibrate(uint64)
Calibrate triggers an event to calibrate consensus context
func (*Standalone) HandleConsensusMsg ¶
func (s *Standalone) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error
HandleConsensusMsg handles incoming consensus message
func (*Standalone) Metrics ¶
func (s *Standalone) Metrics() (ConsensusMetrics, error)
Metrics is not implemented for standalone scheme
func (*Standalone) Start ¶
func (s *Standalone) Start(ctx context.Context) error
Start starts the service for a standalone
func (*Standalone) Stop ¶
func (s *Standalone) Stop(ctx context.Context) error
Stop stops the service for a standalone
func (*Standalone) ValidateBlockFooter ¶
func (s *Standalone) ValidateBlockFooter(*block.Block) error
ValidateBlockFooter validates signatures in block footer
type TellPeerCB ¶
TellPeerCB defines the callback to tell (which is a unicast) message to peers on P2P network