Documentation ¶
Index ¶
Constants ¶
const DefaultStartupTimeout = 30 * time.Second
DefaultStartupTimeout is the default time we wait when starting epoch components before giving up.
Variables ¶
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 ¶
EpochSetupPhaseStarted handles the epoch setup phase started protocol event.
func (*Engine) EpochTransition ¶
EpochTransition handles the epoch transition protocol event.
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 network.Engine, sync network.Engine, hotstuff module.HotStuff, err error, ) }
EpochComponentsFactory is responsible for creating epoch-scoped components managed by the epoch manager engine for the given epoch.