Documentation ¶
Index ¶
- Constants
- func WithAccumulatePool(wp *pool.WorkerPool) opt
- func WithCache(c Cache) opt
- func WithFetchPool(wp *pool.WorkerPool) opt
- func WithLogger(logger util.Logger) opt
- func WithMetrics(metrics util.Metrics) opt
- func WithWritePool(wp *pool.WorkerPool) opt
- type Cache
- type Config
- type Driver
- type Poller
Constants ¶
View Source
const ( // ModeReady means the poller is ready to have its mode reassessed based on chaintip position ModeReady = iota // ModeSleep means the poller is within reorg depth and is waiting to chaintip to progress before reassessing ModeSleep // ModePaused means the poller has been manually paused - it will stay in this state until manually resumed ModePaused // ModeBackfill means the poller is >= batchSize blocks from chaintip and will pull a batch of past blocks ModeBackfill // ModeChaintip means the poller is < batchSize blocks from chaintip and will pull one block at a time ModeChaintip )
Modes determine what the poller does on each iteration of its main routine's loop; these are determined by the distance of the cursor from chaintip and the success/failure state of the previous iteration
Variables ¶
This section is empty.
Functions ¶
func WithAccumulatePool ¶
func WithAccumulatePool(wp *pool.WorkerPool) opt
func WithFetchPool ¶
func WithFetchPool(wp *pool.WorkerPool) opt
func WithLogger ¶
func WithMetrics ¶
func WithWritePool ¶
func WithWritePool(wp *pool.WorkerPool) opt
Types ¶
type Config ¶
type Config struct { Blockchain constants.Blockchain `env:"BLOCKCHAIN,required"` BatchSize int `env:"BATCH_SIZE" envDefault:"100"` ReorgDepth int `env:"REORG_DEPTH" envDefault:"8"` HttpRetries int `env:"HTTP_RETRIES" envDefault:"10"` SleepTime time.Duration `env:"POLLER_SLEEP_TIME" envDefault:"12s"` Tick time.Duration `env:"POLLER_TICK_DURATION" envDefault:"1s"` AutoStart bool `env:"POLLER_AUTO_START" envDefault:"false"` }
type Driver ¶
type Driver interface { Blockchain() string GetChainTipNumber(ctx context.Context) (uint64, error) // FetchSequence involves fetching trace and receipt from ethrpc node FetchSequence(blockNumber uint64) map[string]pool.Runner // Fetchers involves fetching contract's abi and metadata, using results from FetchContractAddresses Fetchers() map[string]pool.FeedTransformer // Accumulate involves combining abi, metadata to form a complete contract, building fragments Accumulate(res interface{}) pool.Runner // Writers involves writing to postgresDB Writers() []pool.FeedTransformer }
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
Poller is a chain-agnostic module for ETLing blockchain data, utilizing worker pools to optimize efficiency and speed
func New ¶
New constructs a new poller, given a config, a chain-specific driver, and a variadic array of options
Source Files ¶
Click to show internal directories.
Click to hide internal directories.