config

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTomlConf

func LoadTomlConf(fpath string, cfg interface{})

Types

type BlockchainConf

type BlockchainConf struct {
	ChainID   uint64    `toml:"chain_id"`
	ChainDB   SqlDbConf `toml:"chain_db"`
	CacheSize int       `toml:"cache_size"`
}

type EvmKvConf

type EvmKvConf struct {
	IndexDB  KVconf `toml:"index_db"`
	NodeBase KVconf `toml:"node_base"`

	// evm raw leveldb
	Fpath     string ` toml:"fpath"`
	Cache     int    ` toml:"cache"`
	Handles   int    ` toml:"handles"`
	Namespace string ` toml:"namespace"`
	ReadOnly  bool   ` toml:"read_only"`
}

type KVconf

type KVconf struct {
	// "bolt"
	KvType string `toml:"kv_type"`
	// dbpath, such as boltdb, pebble
	Path string `toml:"path"`
	// distributed kvdb
	Hosts []string `toml:"hosts"`
}

type KernelConf

type KernelConf struct {
	// 0: FullNode
	// 1: LightNode
	// 2: ArchiveNode
	NodeType int `toml:"node_type"`
	// All database files store in data_dir
	DataDir string `toml:"data_dir"`
	// 0: FullSync
	// 1: FastSync
	// 2: LightSync
	SyncMode int `toml:"sync_mode"`
	// 0: local-node
	// 1: master-worker
	RunMode RunMode `toml:"run_mode"`
	// grpc endpoint, only master-worker has it.
	GrpcPort string `toml:"grpc_port"`
	// serve http port
	HttpPort string `toml:"http_port"`
	// serve websocket port
	WsPort string `toml:"ws_port"`
	// log out level:
	// panic, fatal, error, warn, info, debug, trace
	LogLevel string `toml:"log_level"`
	// log out put file path
	LogOutput string `toml:"log_output"`

	LeiLimit uint64 `toml:"lei_limit"`

	StatedbType string `toml:"statedb_type"`

	KVDB KVconf `toml:"kvdb"`
	//---------component config---------
	BlockChain BlockchainConf `toml:"block_chain"`
	Txpool     TxpoolConf     `toml:"txpool"`
	P2P        P2pConf        `toml:"p2p"`

	//---------for test------------
	IsAdmin bool `toml:"is_admin"`
	// for test, when blockchain runs till MaxBlockNum, it will stop
	// 0 means never stop.
	MaxBlockNum BlockNum `toml:"max_block_num"`

	EnablePProf bool   `toml:"enable_pprof"`
	PProfPort   string `toml:"pprof_port"`
}

func InitDefaultCfg

func InitDefaultCfg() *KernelConf

type MptKvConf

type MptKvConf struct {
	IndexDB  KVconf `toml:"index_db"`
	NodeBase KVconf `toml:"node_base"`
}

type P2pConf

type P2pConf struct {
	// For listening from blockchain network.
	P2pListenAddrs []string `toml:"p2p_listen_addrs"`
	// To connect other hosts as a p2p network.
	Bootnodes []string `toml:"bootnodes"`

	ProtocolID string `toml:"protocol_id"`
	// 0: RSA
	// 1: Ed25519
	// 2: Secp256k1
	// 3: ECDSA
	NodeKeyType int `toml:"node_key_type"`

	NodeKeyRandSeed int64 `toml:"node_key_rand_seed"`

	NodeKey string `toml:"node_key"`

	// Only RSA has this param.
	NodeKeyBits int `toml:"node_key_bits"`
	// When use param 'NodeKey', 'NodeKeyFile' will not work.
	NodeKeyFile string `toml:"node_key_file"`
}

type SqlDbConf

type SqlDbConf struct {
	SqlDbType string `toml:"sql_db_type"`
	Dsn       string `toml:"dsn"`
}

type StateConf

type StateConf struct {
	KV MptKvConf `toml:"kv"`
}

type TxpoolConf

type TxpoolConf struct {
	PoolSize   int `toml:"pool_size"`
	TxnMaxSize int `toml:"txn_max_size"`
}

Jump to

Keyboard shortcuts

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