node

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: ISC Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Controller

func Controller(logger zerolog.Logger) *chainController

Types

type BeaconCtl

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

func NewBeaconCtl

func NewBeaconCtl(ctx context.Context, logger zerolog.Logger, cfg *Config) BeaconCtl

func (*BeaconCtl) ChainCtx

func (beaconCtl *BeaconCtl) ChainCtx() chain.IChainCtx

func (*BeaconCtl) ChainProvider

func (beaconCtl *BeaconCtl) ChainProvider() *cprovider.ChainProvider

func (*BeaconCtl) Init

func (beaconCtl *BeaconCtl) Init() error

func (*BeaconCtl) Run

func (beaconCtl *BeaconCtl) Run(ctx context.Context)

func (*BeaconCtl) Stats

func (beaconCtl *BeaconCtl) Stats() map[string]float64

type Config

type Config struct {
	ConfigFile  string `toml:"-" yaml:"-" short:"C" long:"configfile" description:"Path to configuration file"`
	ShowVersion bool   `toml:"-" yaml:"-" short:"V" long:"version" description:"Display version information and exit"`

	Node      InstanceConfig     `toml:"node" yaml:"node"`
	LogConfig corelog.Config     `toml:"log_config" yaml:"log_config" `
	Metrics   MetricsConfig      `toml:"metrics" yaml:"metrics"`
	BTCD      btcd.Configuration `toml:"btcd" yaml:"btcd"`

	DataDir       string   `toml:"data_dir" yaml:"data_dir" short:"b" long:"datadir" description:"Directory to store data"`
	LogDir        string   `toml:"log_dir" yaml:"log_dir" long:"logdir" description:"Directory to log output."`
	CPUProfile    string   `toml:"cpu_profile" yaml:"cpu_profile" long:"cpuprofile" description:"Write CPU profile to the specified file"`
	DebugLevel    string   `` /* 313-byte string literal not displayed */
	Profile       string   `` /* 138-byte string literal not displayed */
	DropAddrIndex bool     `` /* 170-byte string literal not displayed */
	DropCfIndex   bool     `` /* 180-byte string literal not displayed */
	DropTxIndex   bool     `` /* 161-byte string literal not displayed */
	TorIsolation  bool     `` /* 156-byte string literal not displayed */
	Whitelists    []string `` /* 143-byte string literal not displayed */

}

type DBCtl

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

type IMetric

type IMetric interface {
	Read()
}

IMetric metric reader

func MetricsOfChain added in v0.3.13

func MetricsOfChain(chain statsProvider, logger zerolog.Logger) (res IMetric)

func MetricsOfNode added in v0.3.13

func MetricsOfNode(cfg *Config, stats nodeStatsProvider, logger zerolog.Logger) (res IMetric)

type IMetricManager

type IMetricManager interface {
	Add(metrics ...IMetric)
	Listen(route string, port uint16) error
}

IMetricManager metric manager

func MetricsManager added in v0.3.13

func MetricsManager(ctx context.Context, interval time.Duration) IMetricManager

MetricsManager creates metric instance

type Index

type Index struct {
	LastShardID      uint32               `json:"last_shard_id"`
	LastBeaconHeight int32                `json:"last_beacon_height"`
	Shards           map[uint32]ShardInfo `json:"shards"`
}

func (*Index) AddShard

func (index *Index) AddShard(block *jaxutil.Block, opts p2p.ListenOpts) uint32

type InstanceConfig added in v0.3.13

type InstanceConfig struct {
	BeaconChain    cprovider.ChainRuntimeConfig `yaml:"beacon_chain" toml:"beacon_chain"`
	RPC            rpc.Config                   `yaml:"rpc" toml:"rpc"`
	P2P            p2p.Config                   `yaml:"p2p" toml:"p2p"`
	Shards         ShardConfig                  `yaml:"shards" toml:"shards"`
	DbType         string                       `yaml:"db_type" toml:"db_type" description:"Database backend to use for the Block Chain"`
	Net            string                       `yaml:"net" toml:"net"`
	EnableCPUMiner bool                         `yaml:"enable_cpu_miner" toml:"enable_cpu_miner"`
}

func (*InstanceConfig) ChainParams added in v0.3.13

func (cfg *InstanceConfig) ChainParams() *chaincfg.Params

type MetricsConfig

type MetricsConfig struct {
	Enable   bool   `yaml:"enable" toml:"enable"`
	Interval int    `yaml:"interval" toml:"interval"`
	Port     uint16 `yaml:"port" toml:"port"`
}

type ShardConfig

type ShardConfig struct {
	Enable      bool                                    `yaml:"enable" toml:"enable"`
	Autorun     bool                                    `yaml:"autorun" toml:"autorun"`
	ChainParams map[uint32]cprovider.ChainRuntimeConfig `yaml:"chain_params" toml:"chain_params"`
}

type ShardCtl

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

func NewShardCtl

func NewShardCtl(ctx context.Context, log zerolog.Logger, cfg *Config,
	chain chain.IChainCtx, listenCfg p2p.ListenOpts) *ShardCtl

func (*ShardCtl) ChainCtx

func (shardCtl *ShardCtl) ChainCtx() chain.IChainCtx

func (*ShardCtl) ChainProvider

func (shardCtl *ShardCtl) ChainProvider() *cprovider.ChainProvider

func (*ShardCtl) Init

func (shardCtl *ShardCtl) Init(beaconBlockGen shard.BeaconBlockProvider) error

func (*ShardCtl) Run

func (shardCtl *ShardCtl) Run(ctx context.Context)

func (*ShardCtl) Stats

func (shardCtl *ShardCtl) Stats() map[string]float64

type ShardInfo

type ShardInfo struct {
	ID            uint32         `json:"id"`
	LastVersion   wire.BVersion  `json:"last_version"`
	GenesisHeight int32          `json:"genesis_height"`
	GenesisHash   string         `json:"genesis_hash"`
	Enabled       bool           `json:"enabled"`
	P2PInfo       p2p.ListenOpts `json:"p2p_info"`
}

Directories

Path Synopsis
indexers
Package indexers implements optional block chain indexes.
Package indexers implements optional block chain indexes.
Package chaindata: Functions related to Block Serial ID feature.
Package chaindata: Functions related to Block Serial ID feature.
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.

Jump to

Keyboard shortcuts

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