epochmgr

package
v0.19.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: AGPL-3.0 Imports: 13 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 ErrUnstakedForEpoch = fmt.Errorf("we are not a staked node in the epoch")

ErrUnstakedForEpoch is returned when we attempt to create epoch components for an epoch in which we are not staked. 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, _ *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 {
	// contains filtered or unexported fields
}

EpochComponents represents all dependencies for running an epoch.

func (*EpochComponents) Done

func (ec *EpochComponents) Done() <-chan struct{}

Done stops all epoch components.

func (*EpochComponents) Ready

func (ec *EpochComponents) Ready() <-chan struct{}

Ready starts all epoch components.

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 ErrUnstakedForEpoch if this node is not staked in the epoch.
	Create(epoch protocol.Epoch) (
		state cluster.State,
		proposal module.Engine,
		sync module.Engine,
		hotstuff module.HotStuff,
		err error,
	)
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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