eventhandler

package
v0.28.12 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandler

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

EventHandler is the main handler for individual events that trigger state transition. It exposes API to handle one event at a time synchronously. The caller is responsible for running the event loop to ensure that.

func NewEventHandler added in v0.23.9

func NewEventHandler(
	log zerolog.Logger,
	paceMaker hotstuff.PaceMaker,
	blockProducer hotstuff.BlockProducer,
	forks hotstuff.Forks,
	persist hotstuff.Persister,
	communicator hotstuff.Communicator,
	committee hotstuff.Committee,
	voteAggregator hotstuff.VoteAggregator,
	voter hotstuff.Voter,
	validator hotstuff.Validator,
	notifier hotstuff.Consumer,
) (*EventHandler, error)

NewEventHandler creates an EventHandler instance with initial components.

func (*EventHandler) OnLocalTimeout

func (e *EventHandler) OnLocalTimeout() error

OnLocalTimeout is called when the timeout event created by pacemaker looped through the event loop.

func (*EventHandler) OnQCConstructed added in v0.23.9

func (e *EventHandler) OnQCConstructed(qc *flow.QuorumCertificate) error

OnQCConstructed processes constructed QC by our vote aggregator

func (*EventHandler) OnReceiveProposal

func (e *EventHandler) OnReceiveProposal(proposal *model.Proposal) error

OnReceiveProposal processes the block when a block proposal is received. It is assumed that the block proposal is incorporated. (its parent can be found in the forks)

func (*EventHandler) Start

func (e *EventHandler) Start() error

Start will start the pacemaker's timer and start the new view

func (*EventHandler) TimeoutChannel

func (e *EventHandler) TimeoutChannel() <-chan time.Time

TimeoutChannel returns the channel for subscribing the waiting timeout on receiving block or votes for the current view.

Jump to

Keyboard shortcuts

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