Documentation ¶
Overview ¶
Package eventsyncer implements functions for syncing registry contract events by reading them using executionclient and processing them using eventhandler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNodeNotReady is returned when node is not ready. ErrNodeNotReady = fmt.Errorf("node not ready") )
Functions ¶
This section is empty.
Types ¶
type EventHandler ¶
type EventHandler interface {
HandleBlockEventsStream(logs <-chan executionclient.BlockLogs, executeTasks bool) (uint64, error)
}
type EventSyncer ¶
type EventSyncer struct {
// contains filtered or unexported fields
}
EventSyncer syncs registry contract events from the given ExecutionClient and passes them to the given EventHandler for processing.
func New ¶
func New(nodeStorage nodestorage.Storage, executionClient ExecutionClient, eventHandler EventHandler, opts ...Option) *EventSyncer
func (*EventSyncer) Healthy ¶
func (es *EventSyncer) Healthy(ctx context.Context) error
Healthy returns nil if the syncer is syncing ongoing events.
func (*EventSyncer) SyncHistory ¶
func (es *EventSyncer) SyncHistory(ctx context.Context, fromBlock uint64) (lastProcessedBlock uint64, err error)
SyncHistory reads and processes historical events since the given fromBlock.
func (*EventSyncer) SyncOngoing ¶
func (es *EventSyncer) SyncOngoing(ctx context.Context, fromBlock uint64) error
SyncOngoing streams and processes ongoing events as they come since the given fromBlock.
type ExecutionClient ¶
type Option ¶
type Option func(*EventSyncer)
Option defines EventSyncer configuration option.
func WithStalenessThreshold ¶
Click to show internal directories.
Click to hide internal directories.