Documentation ¶
Index ¶
- type Config
- type Engine
- func (e *Engine) Done() <-chan struct{}
- func (e *Engine) OnFinalizedBlock(flow.Identifier)
- func (e *Engine) Process(channel network.Channel, originID flow.Identifier, event interface{}) error
- func (e *Engine) ProcessLocal(event interface{}) error
- func (e *Engine) Ready() <-chan struct{}
- func (e *Engine) Submit(channel network.Channel, originID flow.Identifier, event interface{})
- func (e *Engine) SubmitLocal(event interface{})
- type OptionFunc
- type RequestHeap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the synchronization engine, responsible for synchronizing chain state.
func New ¶
func New( log zerolog.Logger, metrics module.EngineMetrics, net module.Network, me module.Local, state protocol.State, blocks storage.Blocks, comp network.Engine, core module.SyncCore, opts ...OptionFunc, ) (*Engine, error)
New creates a new main chain synchronization engine.
func (*Engine) Done ¶
func (e *Engine) Done() <-chan struct{}
Done returns a done channel that is closed once the engine has fully stopped. For the consensus engine, we wait for hotstuff to finish.
func (*Engine) OnFinalizedBlock ¶ added in v0.19.0
func (e *Engine) OnFinalizedBlock(flow.Identifier)
OnFinalizedBlock implements the `OnFinalizedBlock` callback from the `hotstuff.FinalizationConsumer`
(1) Updates local state of last finalized snapshot.
CAUTION: the input to this callback is treated as trusted; precautions should be taken that messages from external nodes cannot be considered as inputs to this function
func (*Engine) Process ¶
func (e *Engine) Process(channel network.Channel, originID flow.Identifier, event interface{}) error
Process processes the given event from the node with the given origin ID in a blocking manner. It returns the potential processing error when done.
func (*Engine) ProcessLocal ¶
ProcessLocal processes an event originating on the local node.
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready returns a ready channel that is closed once the engine has fully started. For consensus engine, this is true once the underlying consensus algorithm has started.
func (*Engine) Submit ¶
func (e *Engine) Submit(channel network.Channel, originID flow.Identifier, event interface{})
Submit submits the given event from the node with the given origin ID for processing in a non-blocking manner. It returns instantly and logs a potential processing error internally when done.
func (*Engine) SubmitLocal ¶
func (e *Engine) SubmitLocal(event interface{})
SubmitLocal submits an event originating on the local node.
type OptionFunc ¶
type OptionFunc func(*Config)
func WithPollInterval ¶
func WithPollInterval(interval time.Duration) OptionFunc
WithPollInterval sets a custom interval at which we scan for poll items
func WithScanInterval ¶
func WithScanInterval(interval time.Duration) OptionFunc
WithScanInterval sets a custom interval at which we scan for pending items and batch them for requesting.
type RequestHeap ¶ added in v0.19.0
type RequestHeap struct {
// contains filtered or unexported fields
}
RequestHeap is a special structure that implements engine.MessageStore interface and indexes requests by originator. If request will be sent by same originator then it will replace the old one. Comparing to default FIFO queue this one can contain MAX one request for origin ID. Getting value from queue as well as ejecting is pseudo-random.
func NewRequestHeap ¶ added in v0.19.0
func NewRequestHeap(limit uint) *RequestHeap