Help us shape the future of Go! Take the 2026 Go Developer Survey

bootstrap

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 23 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MIGRATION_TABLE_NAME    = "schema_migrations"
	MIGRATION_GITHUB_TARGET = "github://%s:%s@crypto-com/chain-indexing/migrations%s"
)
View Source
const DEFAULT_MAX_RETRY_INTERVAL = 15 * time.Minute
View Source
const DEFAULT_MAX_RETRY_TIME = MAX_RETRY_TIME_ALWAYS_RETRY
View Source
const DEFAULT_POLLING_INTERVAL = 5 * time.Second
View Source
const INFO_DEFAULT_POLLING_INTERVAL = 5 * time.Second

TODO: Move InfoManager to CronJob

View Source
const MAX_RETRY_TIME_ALWAYS_RETRY = 0
View Source
const SYSTEM_MODE_API_ONLY = "API_ONLY"
View Source
const SYSTEM_MODE_EVENT_STORE = "EVENT_STORE"
View Source
const SYSTEM_MODE_TENDERMINT_DIRECT = "TENDERMINT_DIRECT"

Variables

This section is empty.

Functions

func NewApp

func NewApp(logger applogger.Logger, config *Config) *app

func SetupRDbConn

func SetupRDbConn(config *Config, logger applogger.Logger) (rdb.Conn, error)

Types

type BlockchainConfig

type BlockchainConfig struct {
	BondingDenom           string `toml:"bonding_denom"`
	AccountAddressPrefix   string `toml:"account_address_prefix"`
	AccountPubKeyPrefix    string `toml:"account_pubkey_prefix"`
	ValidatorAddressPrefix string `toml:"validator_address_prefix"`
	ValidatorPubKeyPrefix  string `toml:"validator_pubkey_prefix"`
	ConNodeAddressPrefix   string `toml:"connode_address_prefix"`
	ConNodePubKeyPrefix    string `toml:"connode_pubkey_prefix"`
}

type CLIConfig

type CLIConfig struct {
	LoggerColor *bool
	LogLevel    string

	DatabaseSSL      *bool
	DatabaseHost     string
	DatabasePort     *int32
	DatabaseUsername string
	DatabasePassword string
	DatabaseName     string
	DatabaseSchema   string

	TendermintHTTPRPCUrl string
	CosmosHTTPRPCUrl     string
}

type Config

type Config struct {
	FileConfig
}

func (*Config) OverrideByCLIConfig

func (config *Config) OverrideByCLIConfig(cliConfig *CLIConfig)

type CosmosAppConfig

type CosmosAppConfig struct {
	HTTPRPCUrl string `toml:"http_rpc_url"`
	Insecure   bool   `toml:"insecure"`
}

type CosmosVersionEnabledHeightConfig

type CosmosVersionEnabledHeightConfig struct {
	V0_42_7 uint64 `toml:"v0_42_7"`
}

type CronJobConfig

type CronJobConfig struct {
	Enables []string `toml:"enables"`
}

type DatabaseConfig

type DatabaseConfig struct {
	SSL      bool   `toml:"ssl"`
	Host     string `toml:"host"`
	Port     int32  `toml:"port"`
	Username string `toml:"username"`
	Password string
	Name     string `toml:"name"`
	Schema   string `toml:"schema"`
}

type DebugConfig

type DebugConfig struct {
	PprofEnable           bool   `toml:"pprof_enable"`
	PprofListeningAddress string `toml:"pprof_listening_address"`
}

type FileConfig

type FileConfig struct {
	Blockchain                 BlockchainConfig
	System                     SystemConfig
	Sync                       SyncConfig
	Tendermint                 TendermintConfig
	CosmosApp                  CosmosAppConfig `toml:"cosmosapp"`
	HTTP                       HTTPConfig
	Debug                      DebugConfig
	Database                   DatabaseConfig
	Postgres                   PostgresConfig
	Logger                     LoggerConfig
	Projection                 ProjectionConfig
	CronJob                    CronJobConfig                    `toml:"cronjob"`
	CosmosVersionEnabledHeight CosmosVersionEnabledHeightConfig `toml:"cosmos_version_enabled_height"`
	GithubAPI                  GithubAPIConfig                  `toml:"github_api"`
}

FileConfig is the struct matches config.toml

type GithubAPIConfig added in v1.1.0

type GithubAPIConfig struct {
	Username         string `toml:"username"`
	Token            string `toml:"token"`
	MigrationRepoRef string `toml:"migration_repo_ref"`
}

type HTTPAPIServer

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

func NewHTTPAPIServer

func NewHTTPAPIServer(logger applogger.Logger, config *Config) *HTTPAPIServer

func (*HTTPAPIServer) RegisterRoutes

func (server *HTTPAPIServer) RegisterRoutes(registry RouteRegistry)

func (*HTTPAPIServer) Run

func (server *HTTPAPIServer) Run() error

type HTTPConfig

type HTTPConfig struct {
	ListeningAddress   string   `toml:"listening_address"`
	RoutePrefix        string   `toml:"route_prefix"`
	CorsAllowedOrigins []string `toml:"cors_allowed_origins"`
	CorsAllowedMethods []string `toml:"cors_allowed_methods"`
	CorsAllowedHeaders []string `toml:"cors_allowed_headers"`
}

type IndexService

type IndexService struct {
	GithubAPIUser  string
	GithubAPIToken string
	// contains filtered or unexported fields
}

func NewIndexService

func NewIndexService(
	logger applogger.Logger,
	rdbConn rdb.Conn,
	config *Config,
	projections []projection_entity.Projection,
	cronJobs []projection_entity.CronJob,
) *IndexService

NewIndexService creates a new server instance for polling and indexing

func (*IndexService) Run

func (service *IndexService) Run() error

func (*IndexService) RunEventStoreMode

func (service *IndexService) RunEventStoreMode() error

func (*IndexService) RunTendermintDirectMode

func (service *IndexService) RunTendermintDirectMode() error

type InfoManager

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

func NewInfoManager

func NewInfoManager(
	logger applogger.Logger,
	rdbConn rdb.Conn,
	tendermintRPCUrl string,
	insecureTendermintClient bool,
	strictGenesisParsing bool,
) *InfoManager

func (*InfoManager) Run

func (manager *InfoManager) Run()

type LoggerConfig

type LoggerConfig struct {
	Level string `toml:"level"`
	Color bool   `toml:"color"`
}

type PostgresConfig

type PostgresConfig struct {
	MaxConns            int32  `toml:"pool_max_conns"`
	MinConns            int32  `toml:"pool_min_conns"`
	MaxConnLifeTime     string `toml:"pool_max_conn_lifetime"`
	MaxConnIdleTime     string `toml:"pool_max_conn_idle_time"`
	HealthCheckInterval string `toml:"pool_health_check_interval"`
}

type ProjectionConfig

type ProjectionConfig struct {
	Enables []string `toml:"enables"`
}

type RouteRegistry

type RouteRegistry interface {
	Register(*httpapi.Server, string)
}

type SyncConfig

type SyncConfig struct {
	WindowSize int `toml:"window_size"`
}

type SyncManager

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

func NewSyncManager

func NewSyncManager(
	params SyncManagerParams,
	pm *utils.CosmosParserManager,
	eventHandler eventhandler_interface.Handler,
) *SyncManager

NewSyncManager creates a new feed with polling for latest block starts at a specific height

func (*SyncManager) Run

func (manager *SyncManager) Run() error

Run starts the polling service for blocks

func (*SyncManager) SyncBlocks

func (manager *SyncManager) SyncBlocks(latestHeight int64, isRetry bool) error

SyncBlocks makes request to tendermint, create and dispatch notifications

type SyncManagerConfig

type SyncManagerConfig struct {
	WindowSize               int
	TendermintRPCUrl         string
	InsecureTendermintClient bool
	StrictGenesisParsing     bool

	AccountAddressPrefix string
	StakingDenom         string
}

type SyncManagerParams

type SyncManagerParams struct {
	Logger    applogger.Logger
	RDbConn   rdb.Conn
	TxDecoder *utils.TxDecoder

	Config SyncManagerConfig
}

type SystemConfig

type SystemConfig struct {
	Mode string `toml:"mode"`
}

type TendermintConfig

type TendermintConfig struct {
	HTTPRPCUrl           string `toml:"http_rpc_url"`
	Insecure             bool   `toml:"insecure"`
	StrictGenesisParsing bool   `toml:"strict_genesis_parsing"`
}

Jump to

Keyboard shortcuts

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