eventhandler

package
v0.15.3-patch.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 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 New

func New(
	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)

New 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) 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) OnReceiveVote

func (e *EventHandler) OnReceiveVote(vote *model.Vote) error

OnReceiveVote processes the vote when a vote is received. It is assumed that the voting block is not a missing block

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