events

package
v0.27.4 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: AGPL-3.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distributor

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

Distributor distributes events to a list of subscribers.

func NewDistributor

func NewDistributor() *Distributor

NewDistributor returns a new events distributor.

func (*Distributor) AddConsumer

func (d *Distributor) AddConsumer(consumer protocol.Consumer)

func (*Distributor) BlockFinalized

func (d *Distributor) BlockFinalized(block *flow.Header)

func (*Distributor) BlockProcessable

func (d *Distributor) BlockProcessable(block *flow.Header)

func (*Distributor) EpochCommittedPhaseStarted

func (d *Distributor) EpochCommittedPhaseStarted(epoch uint64, first *flow.Header)

func (*Distributor) EpochSetupPhaseStarted

func (d *Distributor) EpochSetupPhaseStarted(epoch uint64, first *flow.Header)

func (*Distributor) EpochTransition

func (d *Distributor) EpochTransition(newEpoch uint64, first *flow.Header)

type Heights

type Heights interface {

	// OnHeight registers the callback for the given height.
	OnHeight(height uint64, callback func())
}

Heights enables subscribing to specific heights. The callback is invoked when the given height is finalized.

type Noop

type Noop struct{}

Noop is a no-op implementation of protocol.Events.

func NewNoop

func NewNoop() *Noop

func (Noop) BlockFinalized

func (n Noop) BlockFinalized(block *flow.Header)

func (Noop) BlockProcessable

func (n Noop) BlockProcessable(block *flow.Header)

func (Noop) EpochCommittedPhaseStarted

func (n Noop) EpochCommittedPhaseStarted(epoch uint64, first *flow.Header)

func (Noop) EpochSetupPhaseStarted

func (n Noop) EpochSetupPhaseStarted(epoch uint64, first *flow.Header)

func (Noop) EpochTransition

func (n Noop) EpochTransition(newEpoch uint64, first *flow.Header)

type OnViewCallback added in v0.20.0

type OnViewCallback func(*flow.Header)

OnViewCallback is the type of callback triggered by view events.

type Views added in v0.20.0

type Views interface {
	// OnView registers the callback for the given view.
	OnView(view uint64, callback OnViewCallback)
}

Views enables subscribing to specific views. The callback is invoked when the first block of the given view is finalized.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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