pacemaker

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultPaceMaker

type DefaultPaceMaker struct {
	// contains filtered or unexported fields
}

DefaultPaceMaker is the default implementation of PaceMaker interface

func (*DefaultPaceMaker) AddEvent

AddEvent adds an event to the time_service

func (*DefaultPaceMaker) CurView

func (pm *DefaultPaceMaker) CurView() uint64

CurView returns the current view of consensus

func (*DefaultPaceMaker) GetMonitorEvent

func (pm *DefaultPaceMaker) GetMonitorEvent() *timeservice.TimerEvent

GetMonitorEvent export timer event of the monitor that only be called in replay wal mode.

func (*DefaultPaceMaker) OnTimeout

OnTimeout push the local node state machine by a timer event and process the timer event

func (*DefaultPaceMaker) Start

func (pm *DefaultPaceMaker) Start()

Start starts the pacemaker

func (*DefaultPaceMaker) Stop

func (pm *DefaultPaceMaker) Stop()

Stop the service of paceMaker

func (*DefaultPaceMaker) SwitchEpoch

func (pm *DefaultPaceMaker) SwitchEpoch(lastFinalView uint64, round, roundInterval, roundMax uint64)

SwitchEpoch Sets the state of the new epoch

func (*DefaultPaceMaker) TimeoutChannel

func (pm *DefaultPaceMaker) TimeoutChannel() <-chan *timeservice.TimerEvent

TimeoutChannel get the timeout event channel

func (*DefaultPaceMaker) UpdateWithProposal

func (pm *DefaultPaceMaker) UpdateWithProposal(
	proposal *maxbftpb.ProposalData, isNextViewLeader bool) (*timeservice.TimerEvent, bool)

UpdateWithProposal push the local node state machine by a proposal

func (*DefaultPaceMaker) UpdateWithQc

func (pm *DefaultPaceMaker) UpdateWithQc(qc *maxbftpb.QuorumCert) (*timeservice.TimerEvent, bool)

UpdateWithQc push the local node state machine by a qc

func (*DefaultPaceMaker) UpdateWithView

func (pm *DefaultPaceMaker) UpdateWithView(view uint64) bool

UpdateWithView push the local node state machine by a view when replay wal

type PaceMaker

type PaceMaker interface {
	Start()
	Stop()
	CurView() uint64
	TimeoutChannel() <-chan *timeservice.TimerEvent

	OnTimeout(event *timeservice.TimerEvent) *timeservice.TimerEvent
	UpdateWithQc(qc *maxbftpb.QuorumCert) (*timeservice.TimerEvent, bool)
	UpdateWithProposal(
		proposal *maxbftpb.ProposalData, isNextViewLeader bool) (*timeservice.TimerEvent, bool)
	UpdateWithView(view uint64) bool
	AddEvent(stateType maxbftpb.ConsStateType) *timeservice.TimerEvent
	GetMonitorEvent() *timeservice.TimerEvent
	SwitchEpoch(lastFinalView uint64, round, roundInterval, roundMax uint64)
}

PaceMaker defines interface of consensus pacemaker of maxBft, used to maintain the activity of consensus algorithms

func NewPaceMaker

func NewPaceMaker(curView uint64, fork forest.Forester, roundTime, roundTimeInterval,
	maxTime uint64, log protocol.Logger) PaceMaker

NewPaceMaker initials and returns a new DefaultPaceMaker object

type ViewEvent

type ViewEvent struct {
	View      uint64
	Duration  time.Duration
	EventType maxbft.ConsStateType
}

ViewEvent used to describe an time_service event

Jump to

Keyboard shortcuts

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