pacemaker

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

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) Start

func (p *NitroPaceMaker) Start()

Start starts the pacemaker

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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