Documentation ¶
Index ¶
- type NitroPaceMaker
- func (p *NitroPaceMaker) BlockRateDelay() time.Duration
- func (p *NitroPaceMaker) CurView() uint64
- func (p *NitroPaceMaker) OnTimeout() *model.NewViewEvent
- func (p *NitroPaceMaker) Start()
- func (p *NitroPaceMaker) TimeoutChannel() <-chan time.Time
- func (p *NitroPaceMaker) UpdateCurViewWithBlock(block *model.Block, isLeaderForNextView bool) (*model.NewViewEvent, bool)
- func (p *NitroPaceMaker) UpdateCurViewWithQC(qc *flow.QuorumCertificate) (*model.NewViewEvent, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NitroPaceMaker ¶
type NitroPaceMaker struct {
// contains filtered or unexported fields
}
NitroPaceMaker implements the hotstuff.PaceMaker Its an aggressive pacemaker with exponential increase on timeout as well as exponential decrease on progress. Progress is defined as entering view V for which the replica knows a QC with V = QC.view + 1
func New ¶
func New(startView uint64, timeoutController *timeout.Controller, notifier hotstuff.Consumer) (*NitroPaceMaker, error)
New creates a new NitroPaceMaker instance startView is the view for the pacemaker to start from timeoutController controls the timeout trigger. notifier provides callbacks for pacemaker events.
func (*NitroPaceMaker) BlockRateDelay ¶
func (p *NitroPaceMaker) BlockRateDelay() time.Duration
BlockRateDelay returns the delay for broadcasting its own proposals.
func (*NitroPaceMaker) CurView ¶
func (p *NitroPaceMaker) CurView() uint64
CurView returns the current view
func (*NitroPaceMaker) OnTimeout ¶
func (p *NitroPaceMaker) OnTimeout() *model.NewViewEvent
OnTimeout notifies the pacemaker that the timeout event has looped through the event loop. It always trigger a view change, and the new view will be returned as NewViewEvent
func (*NitroPaceMaker) TimeoutChannel ¶
func (p *NitroPaceMaker) TimeoutChannel() <-chan time.Time
TimeoutChannel returns the timeout channel for current active timeout. Note the returned timeout channel returns only one timeout, which is the current timeout. To get the timeout for the next timeout, you need to call TimeoutChannel() again.
func (*NitroPaceMaker) UpdateCurViewWithBlock ¶
func (p *NitroPaceMaker) UpdateCurViewWithBlock(block *model.Block, isLeaderForNextView bool) (*model.NewViewEvent, bool)
UpdateCurViewWithBlock indicates the pacermaker that the block for the current view has received. and isLeaderForNextView indicates whether or not this replica is the primary for the NEXT view.
func (*NitroPaceMaker) UpdateCurViewWithQC ¶
func (p *NitroPaceMaker) UpdateCurViewWithQC(qc *flow.QuorumCertificate) (*model.NewViewEvent, bool)
UpdateCurViewWithQC notifies the pacemaker with a new QC, which might allow pacemaker to fast forward its view.