Documentation ¶
Index ¶
- func GenerateExecutionReceipt(me module.Local, receiptHasher hash.Hasher, result *flow.ExecutionResult, ...) (*flow.ExecutionReceipt, error)
- type Deltas
- type Engine
- func (e *Engine) BlockFinalized(h *flow.Header)
- func (e *Engine) BlockProcessable(b *flow.Header)
- func (e *Engine) Done() <-chan struct{}
- func (e *Engine) ExecuteScriptAtBlockID(ctx context.Context, script []byte, arguments [][]byte, ...) ([]byte, error)
- func (e *Engine) GetAccount(ctx context.Context, addr flow.Address, blockID flow.Identifier) (*flow.Account, error)
- func (e *Engine) GetRegisterAtBlockID(ctx context.Context, owner, key []byte, blockID flow.Identifier) ([]byte, error)
- func (e *Engine) OnCollection(originID flow.Identifier, entity flow.Entity)
- func (e *Engine) Process(channel channels.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 channels.Channel, originID flow.Identifier, event interface{})
- func (e *Engine) SubmitLocal(event interface{})
- type IngestRPC
- type Mempool
- type StopControl
- type StopControlState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deltas ¶
func NewDeltas ¶
func NewDeltas(limit uint, opts ...stdmap.OptionFunc) (*Deltas, error)
NewDeltas creates a new memory pool for state deltas
func (*Deltas) Add ¶
func (s *Deltas) Add(delta *messages.ExecutionStateDelta) bool
Add adds an state deltas to the mempool.
func (*Deltas) All ¶
func (s *Deltas) All() []*messages.ExecutionStateDelta
All returns all block Deltass from the pool.
func (*Deltas) ByBlockID ¶
func (s *Deltas) ByBlockID(blockID flow.Identifier) (*messages.ExecutionStateDelta, bool)
ByBlockID returns the state deltas for a block from the mempool.
type Engine ¶
type Engine struct { psEvents.Noop // satisfy protocol events consumer interface // contains filtered or unexported fields }
An Engine receives and saves incoming blocks.
func New ¶
func New( logger zerolog.Logger, net network.Network, me module.Local, request module.Requester, state protocol.State, blocks storage.Blocks, collections storage.Collections, events storage.Events, serviceEvents storage.ServiceEvents, transactionResults storage.TransactionResults, executionEngine computation.ComputationManager, providerEngine provider.ProviderEngine, execState state.ExecutionState, metrics module.ExecutionMetrics, tracer module.Tracer, extLog bool, syncFilter flow.IdentityFilter, syncDeltas mempool.Deltas, syncThreshold int, syncFast bool, checkAuthorizedAtBlock func(blockID flow.Identifier) (bool, error), pruner *pruner.Pruner, uploader *uploader.Manager, stopControl *StopControl, ) (*Engine, error)
func (*Engine) BlockFinalized ¶
BlockFinalized implements part of state.protocol.Consumer interface. Method gets called for every finalized block
func (*Engine) BlockProcessable ¶
BlockProcessable handles the new verified blocks (blocks that have passed consensus validation) received from the consensus nodes Note: BlockProcessable might be called multiple times for the same block.
func (*Engine) Done ¶
func (e *Engine) Done() <-chan struct{}
Done returns a channel that will close when the engine has successfully stopped.
func (*Engine) ExecuteScriptAtBlockID ¶
func (*Engine) GetAccount ¶
func (*Engine) GetRegisterAtBlockID ¶
func (*Engine) OnCollection ¶
func (e *Engine) OnCollection(originID flow.Identifier, entity flow.Entity)
OnCollection is a callback for handling the collections requested by the collection requester.
func (*Engine) ProcessLocal ¶
ProcessLocal processes an event originating on the local node.
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready returns a channel that will close when the engine has successfully started.
func (*Engine) Submit ¶
func (e *Engine) Submit(channel channels.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 IngestRPC ¶
type IngestRPC interface { // ExecuteScriptAtBlockID executes a script at the given Block id ExecuteScriptAtBlockID(ctx context.Context, script []byte, arguments [][]byte, blockID flow.Identifier) ([]byte, error) // GetAccount returns the Account details at the given Block id GetAccount(ctx context.Context, address flow.Address, blockID flow.Identifier) (*flow.Account, error) // GetRegisterAtBlockID returns the value of a register at the given Block id (if available) GetRegisterAtBlockID(ctx context.Context, owner, key []byte, blockID flow.Identifier) ([]byte, error) }
IngestRPC represents the RPC calls that the execution ingest engine exposes to support the Access Node API calls
type Mempool ¶
type Mempool struct { ExecutionQueue *stdmap.Queues BlockByCollection *stdmap.BlockByCollections }
func (*Mempool) Run ¶
func (m *Mempool) Run(f func(blockByCollection *stdmap.BlockByCollectionBackdata, executionQueue *stdmap.QueuesBackdata) error) error
type StopControl ¶
StopControl is a specialized component used by ingestion.Engine to encapsulate control of pausing/stopping blocks execution. It is intended to work tightly with the Engine, not as a general mechanism or interface. StopControl follows states described in StopState
func NewStopControl ¶
func NewStopControl(log zerolog.Logger, paused bool, lastExecutedHeight uint64) *StopControl
NewStopControl creates new empty NewStopControl
func (*StopControl) GetState ¶
func (s *StopControl) GetState() StopControlState
GetState returns current state of StopControl module
func (*StopControl) GetStopHeight ¶
func (s *StopControl) GetStopHeight() (uint64, bool)
GetStopHeight returns:
- height
- crash
Values are undefined if they were not previously set
func (*StopControl) IsPaused ¶
func (s *StopControl) IsPaused() bool
IsPaused returns true is block execution has been paused
func (*StopControl) SetStopHeight ¶
SetStopHeight sets new stop height and crash mode, and return old values:
- height
- crash
Returns error if the stopping process has already commenced, new values will be rejected.
type StopControlState ¶
type StopControlState byte
const ( // StopControlOff default state, envisioned to be used most of the time. Stopping module is simply off, // blocks will be processed "as usual". StopControlOff StopControlState = iota // StopControlSet means stop height is set but not reached yet, and nothing related to stopping happened yet. // We could still go back to StopControlOff or progress to StopControlCommenced. StopControlSet // StopControlCommenced indicates that stopping process has commenced and no parameters can be changed anymore. // For example, blocks at or above stop height has been received, but finalization didn't reach stop height yet. // It can only progress to StopControlPaused StopControlCommenced // StopControlPaused means EN has stopped processing blocks. It can happen by reaching the set stopping `height`, or // if the node was started in pause mode. // It is a final state and cannot be changed StopControlPaused )