pubsub

package
v0.35.6-crescendo-prev... Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: AGPL-3.0 Imports: 5 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommunicatorDistributor added in v0.31.0

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

CommunicatorDistributor ingests outbound consensus messages from HotStuff's core logic and distributes them to consumers. This logic only runs inside active consensus participants proposing blocks, voting, collecting + aggregating votes to QCs, and participating in the pacemaker (sending timeouts, collecting + aggregating timeouts to TCs). Concurrently safe.

func NewCommunicatorDistributor added in v0.31.0

func NewCommunicatorDistributor() *CommunicatorDistributor

func (*CommunicatorDistributor) AddCommunicatorConsumer added in v0.31.0

func (d *CommunicatorDistributor) AddCommunicatorConsumer(consumer hotstuff.CommunicatorConsumer)

func (*CommunicatorDistributor) OnOwnProposal added in v0.31.0

func (d *CommunicatorDistributor) OnOwnProposal(proposal *flow.Header, targetPublicationTime time.Time)

func (*CommunicatorDistributor) OnOwnTimeout added in v0.31.0

func (d *CommunicatorDistributor) OnOwnTimeout(timeout *model.TimeoutObject)

func (*CommunicatorDistributor) OnOwnVote added in v0.31.0

func (d *CommunicatorDistributor) OnOwnVote(blockID flow.Identifier, view uint64, sigData []byte, recipientID flow.Identifier)

type Distributor

Distributor distributes notifications to a list of consumers (event consumers).

It allows thread-safe subscription of multiple consumers to events.

func NewDistributor

func NewDistributor() *Distributor

func (*Distributor) AddConsumer

func (p *Distributor) AddConsumer(consumer hotstuff.Consumer)

AddConsumer adds an event consumer to the Distributor

type FinalizationDistributor added in v0.17.6

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

FinalizationDistributor ingests events from HotStuff's logic for tracking forks + finalization and distributes them to consumers. This logic generally runs inside all nodes (irrespectively whether they are active consensus participants or or only consensus followers). Concurrently safe.

func NewFinalizationDistributor added in v0.17.6

func NewFinalizationDistributor() *FinalizationDistributor

func (*FinalizationDistributor) AddFinalizationConsumer added in v0.31.0

func (d *FinalizationDistributor) AddFinalizationConsumer(consumer hotstuff.FinalizationConsumer)

func (*FinalizationDistributor) AddOnBlockFinalizedConsumer added in v0.17.6

func (d *FinalizationDistributor) AddOnBlockFinalizedConsumer(consumer OnBlockFinalizedConsumer)

func (*FinalizationDistributor) AddOnBlockIncorporatedConsumer added in v0.17.6

func (d *FinalizationDistributor) AddOnBlockIncorporatedConsumer(consumer OnBlockIncorporatedConsumer)

func (*FinalizationDistributor) OnBlockIncorporated added in v0.17.6

func (d *FinalizationDistributor) OnBlockIncorporated(block *model.Block)

func (*FinalizationDistributor) OnFinalizedBlock added in v0.17.6

func (d *FinalizationDistributor) OnFinalizedBlock(block *model.Block)

type FollowerDistributor added in v0.31.0

type FollowerDistributor struct {
	*ProposalViolationDistributor
	*FinalizationDistributor
}

FollowerDistributor ingests consensus follower events and distributes it to consumers. It allows thread-safe subscription of multiple consumers to events.

func NewFollowerDistributor added in v0.31.0

func NewFollowerDistributor() *FollowerDistributor

func (*FollowerDistributor) AddFollowerConsumer added in v0.31.0

func (d *FollowerDistributor) AddFollowerConsumer(consumer hotstuff.FollowerConsumer)

AddFollowerConsumer registers the input `consumer` to be notified on `hotstuff.ConsensusFollowerConsumer` events.

type OnBlockFinalizedConsumer added in v0.17.6

type OnBlockFinalizedConsumer = func(block *model.Block)

type OnBlockIncorporatedConsumer added in v0.17.6

type OnBlockIncorporatedConsumer = func(block *model.Block)

type ParticipantDistributor added in v0.31.0

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

ParticipantDistributor ingests events from HotStuff's core logic and distributes them to consumers. This logic only runs inside active consensus participants proposing blocks, voting, collecting + aggregating votes to QCs, and participating in the pacemaker (sending timeouts, collecting + aggregating timeouts to TCs). Concurrently safe.

func NewParticipantDistributor added in v0.31.0

func NewParticipantDistributor() *ParticipantDistributor

func (*ParticipantDistributor) AddParticipantConsumer added in v0.31.0

func (d *ParticipantDistributor) AddParticipantConsumer(consumer hotstuff.ParticipantConsumer)

func (*ParticipantDistributor) OnCurrentViewDetails added in v0.31.0

func (d *ParticipantDistributor) OnCurrentViewDetails(currentView, finalizedView uint64, currentLeader flow.Identifier)

func (*ParticipantDistributor) OnEventProcessed added in v0.31.0

func (d *ParticipantDistributor) OnEventProcessed()

func (*ParticipantDistributor) OnLocalTimeout added in v0.31.0

func (d *ParticipantDistributor) OnLocalTimeout(currentView uint64)

func (*ParticipantDistributor) OnPartialTc added in v0.31.0

func (d *ParticipantDistributor) OnPartialTc(currentView uint64, partialTc *hotstuff.PartialTcCreated)

func (*ParticipantDistributor) OnQcTriggeredViewChange added in v0.31.0

func (d *ParticipantDistributor) OnQcTriggeredViewChange(oldView uint64, newView uint64, qc *flow.QuorumCertificate)

func (*ParticipantDistributor) OnReceiveProposal added in v0.31.0

func (d *ParticipantDistributor) OnReceiveProposal(currentView uint64, proposal *model.Proposal)

func (*ParticipantDistributor) OnReceiveQc added in v0.31.0

func (d *ParticipantDistributor) OnReceiveQc(currentView uint64, qc *flow.QuorumCertificate)

func (*ParticipantDistributor) OnReceiveTc added in v0.31.0

func (d *ParticipantDistributor) OnReceiveTc(currentView uint64, tc *flow.TimeoutCertificate)

func (*ParticipantDistributor) OnStart added in v0.31.0

func (d *ParticipantDistributor) OnStart(currentView uint64)

func (*ParticipantDistributor) OnStartingTimeout added in v0.31.0

func (d *ParticipantDistributor) OnStartingTimeout(timerInfo model.TimerInfo)

func (*ParticipantDistributor) OnTcTriggeredViewChange added in v0.31.0

func (d *ParticipantDistributor) OnTcTriggeredViewChange(oldView uint64, newView uint64, tc *flow.TimeoutCertificate)

func (*ParticipantDistributor) OnViewChange added in v0.31.0

func (d *ParticipantDistributor) OnViewChange(oldView, newView uint64)

type ProposalViolationDistributor added in v0.31.0

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

ProposalViolationDistributor ingests notifications about HotStuff-protocol violations and distributes them to consumers. Such notifications are produced by the active consensus participants and the consensus follower. Concurrently safe.

func NewProtocolViolationDistributor added in v0.31.0

func NewProtocolViolationDistributor() *ProposalViolationDistributor

func (*ProposalViolationDistributor) AddProposalViolationConsumer added in v0.31.0

func (d *ProposalViolationDistributor) AddProposalViolationConsumer(consumer hotstuff.ProposalViolationConsumer)

func (*ProposalViolationDistributor) OnDoubleProposeDetected added in v0.31.0

func (d *ProposalViolationDistributor) OnDoubleProposeDetected(block1, block2 *model.Block)

func (*ProposalViolationDistributor) OnInvalidBlockDetected added in v0.31.0

func (d *ProposalViolationDistributor) OnInvalidBlockDetected(err flow.Slashable[model.InvalidProposalError])

type TimeoutAggregationDistributor added in v0.31.0

type TimeoutAggregationDistributor struct {
	*TimeoutAggregationViolationDistributor
	*TimeoutCollectorDistributor
}

TimeoutAggregationDistributor ingests timeout aggregation events and distributes it to consumers. It allows thread-safe subscription of multiple consumers to events.

func NewTimeoutAggregationDistributor added in v0.31.0

func NewTimeoutAggregationDistributor() *TimeoutAggregationDistributor

func (*TimeoutAggregationDistributor) AddTimeoutAggregationConsumer added in v0.31.0

func (d *TimeoutAggregationDistributor) AddTimeoutAggregationConsumer(consumer hotstuff.TimeoutAggregationConsumer)

type TimeoutAggregationViolationDistributor added in v0.31.0

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

TimeoutAggregationViolationDistributor ingests notifications about timeout aggregation violations and distributes them to consumers. Such notifications are produced by the timeout aggregation logic. Concurrently safe.

func NewTimeoutAggregationViolationDistributor added in v0.31.0

func NewTimeoutAggregationViolationDistributor() *TimeoutAggregationViolationDistributor

func (*TimeoutAggregationViolationDistributor) AddTimeoutAggregationViolationConsumer added in v0.31.0

func (d *TimeoutAggregationViolationDistributor) AddTimeoutAggregationViolationConsumer(consumer hotstuff.TimeoutAggregationViolationConsumer)

func (*TimeoutAggregationViolationDistributor) OnDoubleTimeoutDetected added in v0.31.0

func (d *TimeoutAggregationViolationDistributor) OnDoubleTimeoutDetected(timeout *model.TimeoutObject, altTimeout *model.TimeoutObject)

func (*TimeoutAggregationViolationDistributor) OnInvalidTimeoutDetected added in v0.31.0

func (d *TimeoutAggregationViolationDistributor) OnInvalidTimeoutDetected(err model.InvalidTimeoutError)

type TimeoutCollectorDistributor added in v0.29.0

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

TimeoutCollectorDistributor ingests notifications about timeout aggregation and distributes them to consumers. Such notifications are produced by the timeout aggregation logic. Concurrently safe.

func NewTimeoutCollectorDistributor added in v0.29.0

func NewTimeoutCollectorDistributor() *TimeoutCollectorDistributor

func (*TimeoutCollectorDistributor) AddTimeoutCollectorConsumer added in v0.31.0

func (d *TimeoutCollectorDistributor) AddTimeoutCollectorConsumer(consumer hotstuff.TimeoutCollectorConsumer)

func (*TimeoutCollectorDistributor) OnNewQcDiscovered added in v0.29.0

func (d *TimeoutCollectorDistributor) OnNewQcDiscovered(qc *flow.QuorumCertificate)

func (*TimeoutCollectorDistributor) OnNewTcDiscovered added in v0.29.0

func (d *TimeoutCollectorDistributor) OnNewTcDiscovered(tc *flow.TimeoutCertificate)

func (*TimeoutCollectorDistributor) OnPartialTcCreated added in v0.29.0

func (d *TimeoutCollectorDistributor) OnPartialTcCreated(view uint64, newestQC *flow.QuorumCertificate, lastViewTC *flow.TimeoutCertificate)

func (*TimeoutCollectorDistributor) OnTcConstructedFromTimeouts added in v0.29.0

func (d *TimeoutCollectorDistributor) OnTcConstructedFromTimeouts(tc *flow.TimeoutCertificate)

func (*TimeoutCollectorDistributor) OnTimeoutProcessed added in v0.31.0

func (d *TimeoutCollectorDistributor) OnTimeoutProcessed(timeout *model.TimeoutObject)

type VoteAggregationDistributor added in v0.31.0

type VoteAggregationDistributor struct {
	*VoteAggregationViolationDistributor
	*VoteCollectorDistributor
}

VoteAggregationDistributor ingests vote aggregation events and distributes it to consumers. It allows thread-safe subscription of multiple consumers to events.

func NewVoteAggregationDistributor added in v0.31.0

func NewVoteAggregationDistributor() *VoteAggregationDistributor

func (*VoteAggregationDistributor) AddVoteAggregationConsumer added in v0.31.0

func (d *VoteAggregationDistributor) AddVoteAggregationConsumer(consumer hotstuff.VoteAggregationConsumer)

type VoteAggregationViolationDistributor added in v0.31.0

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

VoteAggregationViolationDistributor ingests notifications about vote aggregation violations and distributes them to consumers. Such notifications are produced by the vote aggregation logic. Concurrently safe.

func NewVoteAggregationViolationDistributor added in v0.31.0

func NewVoteAggregationViolationDistributor() *VoteAggregationViolationDistributor

func (*VoteAggregationViolationDistributor) AddVoteAggregationViolationConsumer added in v0.31.0

func (d *VoteAggregationViolationDistributor) AddVoteAggregationViolationConsumer(consumer hotstuff.VoteAggregationViolationConsumer)

func (*VoteAggregationViolationDistributor) OnDoubleVotingDetected added in v0.31.0

func (d *VoteAggregationViolationDistributor) OnDoubleVotingDetected(vote1, vote2 *model.Vote)

func (*VoteAggregationViolationDistributor) OnInvalidVoteDetected added in v0.31.0

func (d *VoteAggregationViolationDistributor) OnInvalidVoteDetected(err model.InvalidVoteError)

func (*VoteAggregationViolationDistributor) OnVoteForInvalidBlockDetected added in v0.31.0

func (d *VoteAggregationViolationDistributor) OnVoteForInvalidBlockDetected(vote *model.Vote, invalidProposal *model.Proposal)

type VoteCollectorDistributor added in v0.31.0

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

VoteCollectorDistributor ingests notifications about vote aggregation and distributes them to consumers. Such notifications are produced by the vote aggregation logic. Concurrently safe.

func NewQCCreatedDistributor added in v0.23.9

func NewQCCreatedDistributor() *VoteCollectorDistributor

func (*VoteCollectorDistributor) AddVoteCollectorConsumer added in v0.31.0

func (d *VoteCollectorDistributor) AddVoteCollectorConsumer(consumer hotstuff.VoteCollectorConsumer)

func (*VoteCollectorDistributor) OnQcConstructedFromVotes added in v0.31.0

func (d *VoteCollectorDistributor) OnQcConstructedFromVotes(qc *flow.QuorumCertificate)

func (*VoteCollectorDistributor) OnVoteProcessed added in v0.31.0

func (d *VoteCollectorDistributor) OnVoteProcessed(vote *model.Vote)

Jump to

Keyboard shortcuts

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