watcher

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Contract watcher is built with a more generic interface that allows offloading more of the operational logic to the transformers, allowing them to act more dynamically Built to work primarily with the contract_watcher packaging

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type ContractWatcher

type ContractWatcher struct {
	Transformers []transformer.ContractTransformer
	DB           *postgres.DB
	BlockChain   core.BlockChain
}

func NewContractWatcher

func NewContractWatcher(db *postgres.DB, bc core.BlockChain) ContractWatcher

func (*ContractWatcher) AddTransformers

func (watcher *ContractWatcher) AddTransformers(inits interface{}) error

func (*ContractWatcher) Execute

func (watcher *ContractWatcher) Execute() error

type DiffStatusToWatch added in v0.1.0

type DiffStatusToWatch int
const (
	New DiffStatusToWatch = iota
	Unrecognized
)

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
}

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
	// contains filtered or unexported fields
}

func NewStorageWatcher

func NewStorageWatcher(db *postgres.DB, backFromHeadOfChain int64, statusWriter fs.StatusWriter, diffStatusToWatch DiffStatusToWatch) StorageWatcher

func (StorageWatcher) AddTransformers

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

func (StorageWatcher) Execute

func (watcher StorageWatcher) Execute() error

Jump to

Keyboard shortcuts

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