watcher

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2021 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHeaderMismatch = errors.New("header hash doesn't match between db and diff")
	ReorgWindow       = 50
	ResultsLimit      = 500
)

Functions

This section is empty.

Types

type DiffStatusToWatch added in v0.1.0

type DiffStatusToWatch int
const (
	New DiffStatusToWatch = iota
	Unrecognized
	Pending
)

type EventWatcher

type EventWatcher struct {
	LogExtractor                 logs.ILogExtractor
	ExpectedExtractorError       error
	LogDelegator                 logs.ILogDelegator
	ExpectedDelegatorError       error
	MaxConsecutiveUnexpectedErrs int
	RetryInterval                time.Duration
	StatusWriter                 fs.StatusWriter
	// contains filtered or unexported fields
}

func NewEventWatcher

func NewEventWatcher(db *postgres.DB, bc core.BlockChain, extractor logs.ILogExtractor, delegator logs.ILogDelegator, maxConsecutiveUnexpectedErrs int, retryInterval time.Duration, statusWriter fs.StatusWriter) EventWatcher

func (*EventWatcher) AddTransformers

func (watcher *EventWatcher) AddTransformers(initializers []event.TransformerInitializer) error

Adds transformers to the watcher so that their logs will be extracted and delegated.

func (*EventWatcher) Execute

func (watcher *EventWatcher) Execute(recheckHeaders constants.TransformerExecution) error

Extracts and delegates watched log events.

type IStorageWatcher added in v0.0.10

type IStorageWatcher interface {
	AddTransformers(initializers []storage2.TransformerInitializer)
	Execute() error
	StorageWatcherName() string
}

type StorageWatcher

type StorageWatcher struct {
	HeaderRepository          datastore.HeaderRepository
	AddressTransformers       map[common.Address]storage2.ITransformer // contract address => transformer
	StorageDiffRepository     storage.DiffRepository
	DiffBlocksFromHeadOfChain int64 // the number of blocks from the head of the chain where diffs should be processed
	StatusWriter              fs.StatusWriter
	DiffStatus                DiffStatusToWatch
	Throttler                 utils.ThrottlerFunc
	// contains filtered or unexported fields
}

func NewStorageWatcher

func NewStorageWatcher(db *postgres.DB, backFromHeadOfChain int64, statusWriter fs.StatusWriter, minWaitTime time.Duration) StorageWatcher

func PendingStorageWatcher added in v0.1.1

func PendingStorageWatcher(db *postgres.DB, backFromHeadOfChain int64, statusWriter fs.StatusWriter, minWaitTime time.Duration) StorageWatcher

func UnrecognizedStorageWatcher added in v0.1.1

func UnrecognizedStorageWatcher(db *postgres.DB, backFromHeadOfChain int64, statusWriter fs.StatusWriter, minWaitTime time.Duration) StorageWatcher

func (StorageWatcher) AddTransformers

func (watcher StorageWatcher) AddTransformers(initializers []storage2.TransformerInitializer)

func (StorageWatcher) Execute

func (watcher StorageWatcher) Execute() error

func (StorageWatcher) StorageWatcherName added in v0.1.1

func (watcher StorageWatcher) StorageWatcherName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL