resync

package
v0.7.1-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RESYNC_START            = "RESYNC_START"
	RESYNC_STOP             = "RESYNC_STOP"
	RESYNC_BATCH_SIZE       = "RESYNC_BATCH_SIZE"
	RESYNC_WORKERS          = "RESYNC_WORKERS"
	RESYNC_CLEAR_OLD_CACHE  = "RESYNC_CLEAR_OLD_CACHE"
	RESYNC_TYPE             = "RESYNC_TYPE"
	RESYNC_RESET_VALIDATION = "RESYNC_RESET_VALIDATION"

	RESYNC_MAX_IDLE_CONNECTIONS = "RESYNC_MAX_IDLE_CONNECTIONS"
	RESYNC_MAX_OPEN_CONNECTIONS = "RESYNC_MAX_OPEN_CONNECTIONS"
	RESYNC_MAX_CONN_LIFETIME    = "RESYNC_MAX_CONN_LIFETIME"
)

Env variables

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ResyncType      shared.DataType // The type of data to resync
	ClearOldCache   bool            // Resync will first clear all the data within the range
	ResetValidation bool            // If true, resync will reset the validation level to 0 for the given range

	// DB info
	DB       *postgres.DB
	DBConfig postgres.Config

	HTTPClient *rpc.Client   // Ethereum rpc client
	NodeInfo   node.Info     // Info for the associated node
	Ranges     [][2]uint64   // The block height ranges to resync
	BatchSize  uint64        // BatchSize for the resync http calls (client has to support batch sizing)
	Timeout    time.Duration // HTTP connection timeout in seconds
	Workers    uint64
}

Config holds the parameters needed to perform a resync

func NewConfig

func NewConfig() (*Config, error)

NewConfig fills and returns a resync config from toml parameters

type Resync

type Resync interface {
	Sync() error
}

func NewResyncService

func NewResyncService(settings *Config) (Resync, error)

NewResyncService creates and returns a resync service from the provided settings

type Service

type Service struct {
	// Interface for fetching historical statediff objects over http
	Fetcher eth.Fetcher
	// Interface for transforming payloads into IPLD object models in Postgres
	Transformer eth.Transformer
	// Interface for cleaning out data before resyncing (if clearOldCache is on)
	Cleaner eth.Cleaner
	// Size of batch fetches
	BatchSize uint64
	// Number of goroutines
	Workers int64

	// Chain config
	ChainConfig *params.ChainConfig
	// contains filtered or unexported fields
}

func (*Service) Sync

func (rs *Service) Sync() error

Sync indexes data within a specified block range

Jump to

Keyboard shortcuts

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