legacy

package
v0.0.0-...-eb934a0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSentryDSNNotSet signals that not Data Source Name was provided
	// with which to configure Sentry logging.
	ErrSentryDSNNotSet = errors.New("sentry-dsn must be set if use-sentry " +
		"is true")
)

Functions

func Main

func Main(gitVersion string) func(ctx *cli.Context) error

Main is the entrypoint into the indexer service. This method returns a closure that executes the service and blocks until the service exits. The use of a closure allows the parameters bound to the top-level main package, e.g. GitVersion, to be captured and used once the function is executed.

func ValidateConfig

func ValidateConfig(cfg *Config) error

ValidateConfig ensures additional constraints on the parsed configuration to ensure that it is well-formed.

Types

type Config

type Config struct {

	// ChainID identifies the chain being indexed.
	ChainID uint64

	// L1EthRpc is the HTTP provider URL for L1.
	L1EthRpc string

	// L2EthRpc is the HTTP provider URL for L1.
	L2EthRpc string

	// L1AddressManagerAddress is the address of the address manager for L1.
	L1AddressManagerAddress string

	// PollInterval is the delay between querying L2 for more transaction
	// and creating a new batch.
	PollInterval time.Duration

	// Hostname of the database connection.
	DBHost string

	// Port of the database connection.
	DBPort uint64

	// Username of the database connection.
	DBUser string

	// Password of the database connection.
	DBPassword string

	// Database name of the database connection.
	DBName string

	// LogLevel is the lowest log level that will be output.
	LogLevel string

	// LogTerminal if true, prints to stdout in terminal format, otherwise
	// prints using JSON. If SentryEnable is true this flag is ignored, and logs
	// are printed using JSON.
	LogTerminal bool

	// L1StartBlockNumber is the block number to start indexing L1 from.
	L1StartBlockNumber uint64

	// L1ConfDepth is the number of confirmations after which headers are
	// considered confirmed on L1.
	L1ConfDepth uint64

	// L2ConfDepth is the number of confirmations after which headers are
	// considered confirmed on L2.
	L2ConfDepth uint64

	// MaxHeaderBatchSize is the maximum number of headers to request as a
	// batch.
	MaxHeaderBatchSize uint64

	// RESTHostname is the hostname at which the REST server is running.
	RESTHostname string

	// RESTPort is the port at which the REST server is running.
	RESTPort uint64

	// MetricsServerEnable if true, will create a metrics client and log to
	// Prometheus.
	MetricsServerEnable bool

	// MetricsHostname is the hostname at which the metrics server is running.
	MetricsHostname string

	// MetricsPort is the port at which the metrics server is running.
	MetricsPort uint64

	// DisableIndexer enables/disables the indexer.
	DisableIndexer bool

	// Bedrock enabled Bedrock indexing.
	Bedrock bool

	BedrockL1StandardBridgeAddress common.Address

	BedrockSlicePortalAddress common.Address
}

func NewConfig

func NewConfig(ctx *cli.Context) (Config, error)

NewConfig parses the Config from the provided flags or environment variables. This method fails if ValidateConfig deems the configuration to be malformed.

type Indexer

type Indexer struct {
	// contains filtered or unexported fields
}

Indexer is a service that configures the necessary resources for running the Sync and BlockHandler sub-services.

func NewIndexer

func NewIndexer(cfg Config) (*Indexer, error)

NewIndexer initializes the Indexer, gathering any resources that will be needed by the TxIndexer and StateIndexer sub-services.

func (*Indexer) Serve

func (b *Indexer) Serve() error

Serve spins up a REST API server at the given hostname and port.

func (*Indexer) Start

func (b *Indexer) Start() error

Start starts the starts the indexing service on L1 and L2 chains and also starts the REST server.

func (*Indexer) Stop

func (b *Indexer) Stop()

Stop stops the indexing service on L1 and L2 chains.

Jump to

Keyboard shortcuts

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