types

package
v0.0.0-...-2adbdf0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HomePath = ""
)

Functions

func BindFlagsLoadViper

func BindFlagsLoadViper(cmd *cobra.Command, _ []string) error

BindFlagsLoadViper binds all flags and read the config into viper

func GetConfigFilePath

func GetConfigFilePath() string

GetConfigFilePath returns the path to the configuration file given the executable name

func Write

func Write(cfg Config, path string) error

Write allows to write the given configuration into the file present at the given path

Types

type Block

type Block struct {
	Slot      uint64
	Height    uint64
	Hash      string
	Leader    string
	Rewards   []clienttypes.Reward
	Timestamp time.Time
	Txs       []Tx
}

Block contains the data of a single chain block

func NewBlock

func NewBlock(slot, height uint64, hash, leader string, rewards []clienttypes.Reward, timestamp time.Time, txs []Tx) Block

NewBlock allows to build a new Block instance

func NewBlockFromResult

func NewBlockFromResult(parserManager manager.ParserManager, slot uint64, b clienttypes.BlockResult) Block

NewBlockFromResult allows to build new Block instance from BlockResult

type ChainConfig

type ChainConfig interface {
	GetModules() []string
}

ChainConfig contains the data to configure the ChainConfig SDK

func DefaultChainConfig

func DefaultChainConfig() ChainConfig

DefaultChainConfig returns the default instance of ChainConfig

func NewChainConfig

func NewChainConfig(modules []string) ChainConfig

NewChainConfig returns a new ChainConfig instance

type CobraCmdFunc

type CobraCmdFunc func(cmd *cobra.Command, args []string) error

CobraCmdFunc represents a cobra command function

func ConcatCobraCmdFuncs

func ConcatCobraCmdFuncs(fs ...CobraCmdFunc) CobraCmdFunc

ConcatCobraCmdFuncs returns a single function that calls each argument function in sequence RunE, PreRunE, PersistentPreRunE, etc. all have this same signature

type Config

type Config interface {
	GetRPCConfig() RPCConfig
	GetChainConfig() ChainConfig
	GetDatabaseConfig() DatabaseConfig
	GetLoggingConfig() LoggingConfig
	GetParsingConfig() ParsingConfig
	SetParsingConfig(config ParsingConfig)
	GetPruningConfig() PruningConfig
	GetTelemetryConfig() TelemetryConfig
	GetWorkerConfig() WorkerConfig
}

Config represents the configuration to run Juno

var (
	// Cfg represents the configuration to be used during the execution
	Cfg Config
)

func DefaultConfigParser

func DefaultConfigParser(configData []byte) (Config, error)

DefaultConfigParser attempts to read and parse a Juno config from the given string bytes. An error reading or parsing the config results in a panic.

func NewConfig

func NewConfig(
	rpcConfig RPCConfig,
	chainConfig ChainConfig,
	dbConfig DatabaseConfig,
	loggingConfig LoggingConfig,
	parsingConfig ParsingConfig,
	pruningConfig PruningConfig,
	telemetryConfig TelemetryConfig,
	workerConfig WorkerConfig,
) Config

NewConfig builds a new Config instance

func Read

func Read(configPath string, parser ConfigParser) (Config, error)

Read takes the path to a configuration file and returns the properly parsed configuration

type ConfigParser

type ConfigParser = func(fileContents []byte) (Config, error)

ConfigParser represents a function that allows to parse a file contents as a Config object

type DatabaseConfig

type DatabaseConfig interface {
	GetName() string
	GetHost() string
	GetPort() int64
	GetUser() string
	GetPassword() string
	GetSSLMode() string
	GetSchema() string
	GetMaxOpenConnections() int
	GetMaxIdleConnections() int
}

DatabaseConfig represents a generic database configuration

func DefaultDatabaseConfig

func DefaultDatabaseConfig() DatabaseConfig

DefaultDatabaseConfig returns the default instance of DatabaseConfig

func NewDatabaseConfig

func NewDatabaseConfig(
	name, host string, port int64, user string, password string,
	sslMode string, schema string,
	maxOpenConnections int, maxIdleConnections int,
) DatabaseConfig

type Instruction

type Instruction struct {
	TxSignature      string
	Slot             uint64
	Index            int
	InnerIndex       int
	Program          string
	InvolvedAccounts []string
	RawData          string
	Parsed           types.ParsedInstruction
}

func NewInstruction

func NewInstruction(
	signature string,
	slot uint64,
	index int,
	innerIndex int,
	program string,
	involvedAccounts []string,
	rawData string,
	parsed types.ParsedInstruction,
) Instruction

type LoggingConfig

type LoggingConfig interface {
	GetLogLevel() string
	GetLogFormat() string
}

LoggingConfig represents the configuration for the logging part

func DefaultLoggingConfig

func DefaultLoggingConfig() LoggingConfig

DefaultLoggingConfig returns the default LoggingConfig instance

func NewLoggingConfig

func NewLoggingConfig(level, format string) LoggingConfig

NewLoggingConfig returns a new LoggingConfig instance

type ParsingConfig

type ParsingConfig interface {
	GetWorkers() int64
	ShouldParseNewBlocks() bool
	ShouldParseOldBlocks() bool
	GetStartSlot() uint64
	SetStartSlot(slot uint64)
}

ParsingConfig represents the configuration of the parsing

func DefaultParsingConfig

func DefaultParsingConfig() ParsingConfig

DefaultParsingConfig returns the default instance of ParsingConfig

func NewParsingConfig

func NewParsingConfig(
	workers int64,
	parseNewBlocks, parseOldBlocks bool,
	startSlot uint64,
) ParsingConfig

NewParsingConfig allows to build a new ParsingConfig instance

type PruningConfig

type PruningConfig interface {
	GetKeepRecent() int64
	GetKeepEvery() int64
	GetInterval() int64
}

PruningConfig contains the configuration of the pruning strategy

func DefaultPruningConfig

func DefaultPruningConfig() PruningConfig

DefaultPruningConfig returns the default PruningConfig instance

func NewPruningConfig

func NewPruningConfig(keepRecent, keepEvery, interval int64) PruningConfig

NewPruningConfig returns a new PruningConfig

type RPCConfig

type RPCConfig interface {
	GetClientName() string
	GetAddress() string
}

RPCConfig contains the configuration of the RPC endpoint

func DefaultRPCConfig

func DefaultRPCConfig() RPCConfig

DefaultRPCConfig returns the default instance of RPCConfig

func NewRPCConfig

func NewRPCConfig(clientName, address string) RPCConfig

NewRPCConfig allows to build a new RPCConfig instance

type SlotQueue

type SlotQueue chan uint64

SlotQueue is a simple type alias for a (buffered) channel of block heights.

func NewQueue

func NewQueue(size int) SlotQueue

type TelemetryConfig

type TelemetryConfig interface {
	GetPort() uint
}

TelemetryConfig contains the configuration of the telemetry strategy

func DefaultTelemetryConfig

func DefaultTelemetryConfig() TelemetryConfig

DefaultTelemetryConfig returns the default TelemetryConfig instance

func NewTelemetryConfig

func NewTelemetryConfig(port uint) TelemetryConfig

NewTelemetryConfig allows to build a new TelemetryConfig instance

type Tx

type Tx struct {
	Signature    string
	Slot         uint64
	Index        int
	Error        interface{}
	Fee          uint64
	Logs         []string
	Instructions []Instruction

	Accounts          []string
	PostBalances      []uint64
	PostTokenBalances []clienttypes.TransactionTokenBalance
}

Tx represents an already existing blockchain transaction

func NewTx

func NewTx(
	signature string,
	slot uint64,
	index int,
	err interface{},
	fee uint64,
	logs []string,
	instructions []Instruction,
	accounts []string,
	postBalances []uint64,
	postTokenBalances []clienttypes.TransactionTokenBalance,
) Tx

NewTx allows to build a new Tx instance

func NewTxFromTxResult

func NewTxFromTxResult(parserManager manager.ParserManager, slot uint64, index int, txResult clienttypes.EncodedTransactionWithStatusMeta) Tx

func (Tx) Successful

func (tx Tx) Successful() bool

Successful tells whether this tx is successful or not

type Validator

type Validator struct {
	VotePubkey string
	NodePubKey string
}

Validator contains the data of a single validator

func NewValidator

func NewValidator(votePubkey string, nodePubKey string) Validator

NewValidator allows to build a new Validator instance

type WorkerConfig

type WorkerConfig interface {
	GetPoolSize() int
}

WorkerConfig contains the configuration of the worker strategy

func DefaultWorkerConfig

func DefaultWorkerConfig() WorkerConfig

DefaultWorkerConfig returns the default WorkerConfig instance

func NewWorkerConfig

func NewWorkerConfig(poolSize int) WorkerConfig

NewWorkerConfig allows to build a new WorkerConfig instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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