Help us shape the future of Go! Take the 2026 Go Developer Survey

notifications

package
v0.28.13 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: AGPL-3.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogConsumer

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

LogConsumer is an implementation of the notifications consumer that logs a message for each event.

func NewLogConsumer

func NewLogConsumer(log zerolog.Logger) *LogConsumer

func (*LogConsumer) OnBlockIncorporated

func (lc *LogConsumer) OnBlockIncorporated(block *model.Block)

func (*LogConsumer) OnDoubleProposeDetected

func (lc *LogConsumer) OnDoubleProposeDetected(block *model.Block, alt *model.Block)

func (*LogConsumer) OnDoubleVotingDetected

func (lc *LogConsumer) OnDoubleVotingDetected(vote *model.Vote, alt *model.Vote)

func (*LogConsumer) OnEnteringView

func (lc *LogConsumer) OnEnteringView(view uint64, leader flow.Identifier)

func (*LogConsumer) OnEventProcessed

func (lc *LogConsumer) OnEventProcessed()

func (*LogConsumer) OnFinalizedBlock

func (lc *LogConsumer) OnFinalizedBlock(block *model.Block)

func (*LogConsumer) OnForkChoiceGenerated

func (lc *LogConsumer) OnForkChoiceGenerated(view uint64, qc *flow.QuorumCertificate)

func (*LogConsumer) OnInvalidVoteDetected

func (lc *LogConsumer) OnInvalidVoteDetected(vote *model.Vote)

func (*LogConsumer) OnProposingBlock

func (lc *LogConsumer) OnProposingBlock(block *model.Proposal)

func (*LogConsumer) OnQcConstructedFromVotes

func (lc *LogConsumer) OnQcConstructedFromVotes(curView uint64, qc *flow.QuorumCertificate)

func (*LogConsumer) OnQcIncorporated

func (lc *LogConsumer) OnQcIncorporated(qc *flow.QuorumCertificate)

func (*LogConsumer) OnQcTriggeredViewChange

func (lc *LogConsumer) OnQcTriggeredViewChange(qc *flow.QuorumCertificate, newView uint64)

func (*LogConsumer) OnReachedTimeout

func (lc *LogConsumer) OnReachedTimeout(info *model.TimerInfo)

func (*LogConsumer) OnReceiveProposal

func (lc *LogConsumer) OnReceiveProposal(currentView uint64, proposal *model.Proposal)

func (*LogConsumer) OnReceiveVote

func (lc *LogConsumer) OnReceiveVote(currentView uint64, vote *model.Vote)

func (*LogConsumer) OnStartingTimeout

func (lc *LogConsumer) OnStartingTimeout(info *model.TimerInfo)

func (*LogConsumer) OnVoteForInvalidBlockDetected added in v0.23.9

func (lc *LogConsumer) OnVoteForInvalidBlockDetected(vote *model.Vote, proposal *model.Proposal)

func (*LogConsumer) OnVoting

func (lc *LogConsumer) OnVoting(vote *model.Vote)

type NoopConsumer

type NoopConsumer struct{}

NoopConsumer is an implementation of the notifications consumer that doesn't do anything.

func NewNoopConsumer

func NewNoopConsumer() *NoopConsumer

func (*NoopConsumer) OnBlockIncorporated

func (*NoopConsumer) OnBlockIncorporated(*model.Block)

func (*NoopConsumer) OnDoubleProposeDetected

func (*NoopConsumer) OnDoubleProposeDetected(*model.Block, *model.Block)

func (*NoopConsumer) OnDoubleVotingDetected

func (*NoopConsumer) OnDoubleVotingDetected(*model.Vote, *model.Vote)

func (*NoopConsumer) OnEnteringView

func (*NoopConsumer) OnEnteringView(uint64, flow.Identifier)

func (*NoopConsumer) OnEventProcessed

func (*NoopConsumer) OnEventProcessed()

func (*NoopConsumer) OnFinalizedBlock

func (*NoopConsumer) OnFinalizedBlock(*model.Block)

func (*NoopConsumer) OnForkChoiceGenerated

func (*NoopConsumer) OnForkChoiceGenerated(uint64, *flow.QuorumCertificate)

func (*NoopConsumer) OnInvalidVoteDetected

func (*NoopConsumer) OnInvalidVoteDetected(*model.Vote)

func (*NoopConsumer) OnProposingBlock

func (c *NoopConsumer) OnProposingBlock(*model.Proposal)

func (*NoopConsumer) OnQcConstructedFromVotes

func (c *NoopConsumer) OnQcConstructedFromVotes(curView uint64, qc *flow.QuorumCertificate)

func (*NoopConsumer) OnQcIncorporated

func (*NoopConsumer) OnQcIncorporated(*flow.QuorumCertificate)

func (*NoopConsumer) OnQcTriggeredViewChange

func (c *NoopConsumer) OnQcTriggeredViewChange(*flow.QuorumCertificate, uint64)

func (*NoopConsumer) OnReachedTimeout

func (*NoopConsumer) OnReachedTimeout(*model.TimerInfo)

func (*NoopConsumer) OnReceiveProposal

func (c *NoopConsumer) OnReceiveProposal(uint64, *model.Proposal)

func (*NoopConsumer) OnReceiveVote

func (c *NoopConsumer) OnReceiveVote(uint64, *model.Vote)

func (*NoopConsumer) OnStartingTimeout

func (*NoopConsumer) OnStartingTimeout(*model.TimerInfo)

func (*NoopConsumer) OnVoteForInvalidBlockDetected added in v0.23.9

func (*NoopConsumer) OnVoteForInvalidBlockDetected(*model.Vote, *model.Proposal)

func (*NoopConsumer) OnVoting

func (c *NoopConsumer) OnVoting(*model.Vote)

type PathHandler

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

PathHandler maintains a notion of the current path through the state machine. It allows to close a path and open new path. Each path is identified by a unique (randomly generated) uuid. Along each path, we can capture information about relevant Steps (each step is represented by a Zerolog Event). In case there is no currently open path, the PathHandler still returns a Step, but such steps are logged as telemetry errors.

func NewPathHandler

func NewPathHandler(log zerolog.Logger, chain flow.ChainID) *PathHandler

NewPathHandler instantiate a new PathHandler. The PathHandler has no currently open path

func (*PathHandler) CloseCurrentPath

func (p *PathHandler) CloseCurrentPath() *PathHandler

CloseCurrentPath closes the current path. Repeated calls to CloseCurrentPath are handled. All Details hereafter, until a new Path is started, are logged as telemetry Errors. Returns self-reference for chaining

func (*PathHandler) IsCurrentPathClosed

func (p *PathHandler) IsCurrentPathClosed() bool

IsCurrentPathOpen if and only is the most recently started path has been closed.

func (*PathHandler) NextStep

func (p *PathHandler) NextStep() *zerolog.Event

NextStep returns a Zerolog event for the currently open path. If the current path is closed, the event will be logged as telemetry error.

func (*PathHandler) StartNextPath

func (p *PathHandler) StartNextPath(view uint64) *PathHandler

StartNextPath starts a new Path. Implicitly closes previous path if still open. Returns self-reference for chaining

type SlashingViolationsConsumer

type SlashingViolationsConsumer struct {
	NoopConsumer
	// contains filtered or unexported fields
}

SlashingViolationsConsumer is an implementation of the notifications consumer that logs a message for any slashable offenses.

func NewSlashingViolationsConsumer

func NewSlashingViolationsConsumer(log zerolog.Logger) *SlashingViolationsConsumer

func (*SlashingViolationsConsumer) OnDoubleProposeDetected

func (c *SlashingViolationsConsumer) OnDoubleProposeDetected(block1 *model.Block, block2 *model.Block)

func (*SlashingViolationsConsumer) OnDoubleVotingDetected

func (c *SlashingViolationsConsumer) OnDoubleVotingDetected(vote1 *model.Vote, vote2 *model.Vote)

func (*SlashingViolationsConsumer) OnInvalidVoteDetected

func (c *SlashingViolationsConsumer) OnInvalidVoteDetected(vote *model.Vote)

func (*SlashingViolationsConsumer) OnVoteForInvalidBlockDetected added in v0.23.9

func (c *SlashingViolationsConsumer) OnVoteForInvalidBlockDetected(vote *model.Vote, proposal *model.Proposal)

type TelemetryConsumer

type TelemetryConsumer struct {
	NoopConsumer
	// contains filtered or unexported fields
}

TelemetryConsumer implements the hotstuff.Consumer interface. consumes outbound notifications produced by the The HotStuff state machine. For this purpose, the TelemetryConsumer enriches the state machine's notifications:

  • The goal is to identify all events as belonging together that were emitted during a path through the state machine.
  • A path through the state machine begins when: -- a vote is received -- a block is received -- a new view is started -- a timeout is processed
  • Each path through the state machine is identified by a unique id.

Generally, the TelemetryConsumer could export the collected data to a variety of backends. For now, we export the data to a logger.

Telemetry does NOT capture slashing notifications

func NewTelemetryConsumer

func NewTelemetryConsumer(log zerolog.Logger, chain flow.ChainID) *TelemetryConsumer

func (*TelemetryConsumer) OnBlockIncorporated

func (t *TelemetryConsumer) OnBlockIncorporated(block *model.Block)

func (*TelemetryConsumer) OnEnteringView

func (t *TelemetryConsumer) OnEnteringView(viewNumber uint64, leader flow.Identifier)

func (*TelemetryConsumer) OnEventProcessed

func (t *TelemetryConsumer) OnEventProcessed()

func (*TelemetryConsumer) OnFinalizedBlock

func (t *TelemetryConsumer) OnFinalizedBlock(block *model.Block)

func (*TelemetryConsumer) OnForkChoiceGenerated

func (t *TelemetryConsumer) OnForkChoiceGenerated(current_view uint64, qc *flow.QuorumCertificate)

func (*TelemetryConsumer) OnProposingBlock

func (t *TelemetryConsumer) OnProposingBlock(proposal *model.Proposal)

func (*TelemetryConsumer) OnQcConstructedFromVotes

func (t *TelemetryConsumer) OnQcConstructedFromVotes(curView uint64, qc *flow.QuorumCertificate)

func (*TelemetryConsumer) OnQcIncorporated

func (t *TelemetryConsumer) OnQcIncorporated(qc *flow.QuorumCertificate)

func (*TelemetryConsumer) OnQcTriggeredViewChange

func (t *TelemetryConsumer) OnQcTriggeredViewChange(qc *flow.QuorumCertificate, newView uint64)

func (*TelemetryConsumer) OnReachedTimeout

func (t *TelemetryConsumer) OnReachedTimeout(info *model.TimerInfo)

func (*TelemetryConsumer) OnReceiveProposal

func (t *TelemetryConsumer) OnReceiveProposal(currentView uint64, proposal *model.Proposal)

func (*TelemetryConsumer) OnReceiveVote

func (t *TelemetryConsumer) OnReceiveVote(currentView uint64, vote *model.Vote)

func (*TelemetryConsumer) OnStartingTimeout

func (t *TelemetryConsumer) OnStartingTimeout(info *model.TimerInfo)

func (*TelemetryConsumer) OnVoting

func (t *TelemetryConsumer) OnVoting(vote *model.Vote)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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