indexerconfig

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package indexerconfig is the config loader for the indexer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	// ChainID is the ID of the chain.
	ChainID uint32 `yaml:"chain_id"`
	// Contracts are the contracts.
	Contracts []ContractConfig `yaml:"contracts"`
}

ChainConfig is the configuration for a chain.

func (ChainConfig) IsValid

func (c ChainConfig) IsValid() error

IsValid validates the chain config.

type Config

type Config struct {
	// DefaultRefreshRate is the default rate at which data is refreshed in seconds.
	DefaultRefreshRate int `yaml:"default_refresh_rate"`
	// ScribeURL is the URL of the Scribe graphql server.
	ScribeURL string `yaml:"scribe_url"`
	// Chains stores the chain configurations.
	Chains []ChainConfig `yaml:"chains"`
	// DBPath is the path to the database.
	DBPath string `yaml:"db_path"`
	// DBType is the flag signifying the type of database (mysql, sqlite, etc).
	DBType string `yaml:"db_type"`
	// SkipMigrations skips db migrations.
	SkipMigrations bool `yaml:"skip_migrations"`
}

Config is used to configure the sinner's data consumption.

func DecodeConfig

func DecodeConfig(filePath string) (cfg Config, err error)

DecodeConfig parses in a config from a file.

func (*Config) IsValid

func (c *Config) IsValid() error

IsValid makes sure the config is valid. This is done by calling IsValid() on each submodule.

type ContractConfig

type ContractConfig struct {
	// ContractType is the type of contract.
	ContractType string `yaml:"contract_type"`
	// Addresses are the addresses of the contracts
	Address string `yaml:"address"`
	// StartBlock is where to start indexing this address from.
	StartBlock uint64 `yaml:"start_block"`
	// EndBlock is where the end the indexing. This will only backfill a range and will not livefill.
	EndBlock uint64 `yaml:"end_block"`
}

ContractConfig is the configuration for a contract.

func (ContractConfig) IsValid

func (c ContractConfig) IsValid() error

IsValid validates the chain config.

type ContractType

type ContractType int

ContractType is the type of contract specified by the config and used for selecting the correct parser.

const (
	// OriginType is the ContractType for the origin contract.
	OriginType ContractType = iota // origin
	// ExecutionHubType is the ContractType for the execution hub contract.
	ExecutionHubType // execution_hub
	// UnknownType is the ContractType for an unknown contract.
	UnknownType // unknown
)

func ContractTypeFromString

func ContractTypeFromString(s string) (ContractType, error)

ContractTypeFromString converts a string (intended to be from parsed config) into the ContractType type.

func (ContractType) String

func (i ContractType) String() string

Jump to

Keyboard shortcuts

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