epochmgr

package
v0.25.14 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: AGPL-3.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const DefaultStartupTimeout = 30 * time.Second

DefaultStartupTimeout is the default time we wait when starting epoch components before giving up.

Variables

View Source
var ErrNotAuthorizedForEpoch = fmt.Errorf("we are not an authorized participant for the epoch")

ErrNotAuthorizedForEpoch is returned when we attempt to create epoch components for an epoch in which we are not an authorized network participant. This is the case for epochs during which this node is joining or leaving the network.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	events.Noop // satisfy protocol events consumer interface
	// contains filtered or unexported fields
}

Engine is the epoch manager, which coordinates the lifecycle of other modules and processes that are epoch-dependent. The manager is responsible for spinning up engines when a new epoch is about to start and spinning down engines for an epoch that has ended.

func New

func New(
	log zerolog.Logger,
	me module.Local,
	state protocol.State,
	pools *epochs.TransactionPools,
	voter module.ClusterRootQCVoter,
	factory EpochComponentsFactory,
	heightEvents events.Heights,
) (*Engine, error)

func (*Engine) Done

func (e *Engine) Done() <-chan struct{}

Done returns a done channel that is closed once the engine has fully stopped.

func (*Engine) EpochSetupPhaseStarted

func (e *Engine) EpochSetupPhaseStarted(_ uint64, first *flow.Header)

EpochSetupPhaseStarted handles the epoch setup phase started protocol event.

func (*Engine) EpochTransition

func (e *Engine) EpochTransition(_ uint64, first *flow.Header)

EpochTransition handles the epoch transition protocol event.

func (*Engine) Ready

func (e *Engine) Ready() <-chan struct{}

Ready returns a ready channel that is closed once the engine has fully started. For proposal engine, this is true once the underlying consensus algorithm has started.

type EpochComponents

type EpochComponents struct {
	*component.ComponentManager
	// contains filtered or unexported fields
}

EpochComponents represents all dependencies for running an epoch.

func NewEpochComponents added in v0.23.9

func NewEpochComponents(
	state cluster.State,
	prop network.Engine,
	sync network.Engine,
	hotstuff module.HotStuff,
	aggregator hotstuff.VoteAggregator,
) *EpochComponents

type EpochComponentsFactory

type EpochComponentsFactory interface {

	// Create sets up and instantiates all dependencies for the epoch. It may
	// be used either for an ongoing epoch (for example, after a restart) or
	// for an epoch that will start soon. It is safe to call multiple times for
	// a given epoch counter.
	//
	// Must return ErrNotAuthorizedForEpoch if this node is not authorized in the epoch.
	Create(epoch protocol.Epoch) (
		state cluster.State,
		proposal network.Engine,
		sync network.Engine,
		hotstuff module.HotStuff,
		voteAggregator hotstuff.VoteAggregator,
		err error,
	)
}

EpochComponentsFactory is responsible for creating epoch-scoped components managed by the epoch manager engine for the given epoch.

type StartableEpochComponents added in v0.23.9

type StartableEpochComponents struct {
	*EpochComponents
	// contains filtered or unexported fields
}

func NewStartableEpochComponents added in v0.23.9

func NewStartableEpochComponents(components *EpochComponents, signalerCtx irrecoverable.SignalerContext, cancel context.CancelFunc) *StartableEpochComponents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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