Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEventIngestionEngine ¶
func NewEventIngestionEngine( subscriber EventSubscriber, store *pebble.Storage, blocks storage.BlockIndexer, receipts storage.ReceiptIndexer, transactions storage.TransactionIndexer, accounts storage.AccountIndexer, blocksPublisher *models.Publisher, logsPublisher *models.Publisher, log zerolog.Logger, ) *Engine
func (*Engine) Done ¶
func (e *Engine) Done() <-chan struct{}
Done signals when the engine has stopped.
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready signals when the engine has started.
func (*Engine) Run ¶
Run the Cadence event ingestion engine.
Cadence event ingestion engine subscribes to all new EVM related events on Flow network, currently there are two types of events: - evm.BlockExecuted: this event is emitted when a new EVM block is created (usually with any new transactions) - evm.TransactionExecuted: this event is emitted when a new EVM transaction is executed (even if failed) Each event that is received should contain at least block event, but usually also transaction events. There can be multiple transaction events for a single Cadence height, but only a single block event. Events are after indexed in-order, first block event and then all transaction events.
Expected errors: there is a disconnected error which is a recoverable error that can be expected and should be handled by restarting the engine. This can happen if the client connection to the event subscription drops. All other errors are unexpected.
type EventSubscriber ¶
type EventSubscriber interface { // Subscribe to EVM events from the provided height, and return a chanel with the events. // // The BlockEvents type will contain an optional error in case // the error happens, the consumer of the chanel should handle it. Subscribe(ctx context.Context, height uint64) <-chan models.BlockEvents }
type RPCSubscriber ¶
type RPCSubscriber struct {
// contains filtered or unexported fields
}
func NewRPCSubscriber ¶
func NewRPCSubscriber( client *requester.CrossSporkClient, heartbeatInterval uint64, chainID flowGo.ChainID, logger zerolog.Logger, ) *RPCSubscriber
func (*RPCSubscriber) Subscribe ¶
func (r *RPCSubscriber) Subscribe(ctx context.Context, height uint64) <-chan models.BlockEvents
Subscribe will retrieve all the events from the provided height. If the height is from previous sporks, it will first backfill all the events in all the previous sporks, and then continue to listen all new events in the current spork.
If error is encountered during backfill the subscription will end and the response chanel will be closed.