Documentation ¶
Overview ¶
Package conf package
Index ¶
- Constants
- type BigFilterConfig
- type BloomConfig
- type CacheConfig
- type DbConfig
- type HistoryDbConfig
- type StorageConfig
- func (config *StorageConfig) GetActiveDBCount() int
- func (config *StorageConfig) GetBlockDbConfig() *DbConfig
- func (config *StorageConfig) GetContractEventDbConfig() *DbConfig
- func (config *StorageConfig) GetDefaultDBConfig() *DbConfig
- func (config *StorageConfig) GetHistoryDbConfig() *HistoryDbConfig
- func (config *StorageConfig) GetResultDbConfig() *DbConfig
- func (config *StorageConfig) GetStateDbConfig() *DbConfig
- func (config *StorageConfig) GetTxExistDbConfig() *DbConfig
Constants ¶
const ( CommonWriteBlockType = 0 QuickWriteBlockType = 1 DbconfigProviderSql = "sql" DbconfigProviderSqlKV = "sqlkv" //虽然是用SQL数据库,但是当KV数据库使 DbconfigProviderLeveldb = "leveldb" DbconfigProviderMemdb = "memdb" //内存数据库,只用于测试 DbconfigProviderBadgerdb = "badgerdb" DbconfigProviderTikvdb = "tikvdb" )
nolint
const ( SqldbconfigSqldbtypeMysql = "mysql" SqldbconfigSqldbtypeSqlite = "sqlite" )
nolint
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigFilterConfig ¶ added in v2.2.1
type BigFilterConfig struct { RedisHosts string `mapstructure:"redis_hosts_port"` Pass string `mapstructure:"redis_password"` TxCapacity uint `mapstructure:"tx_capacity"` FpRate float64 `mapstructure:"fp_rate"` }
BigFilterConfig bigfilter 配置信息
@Description:
type BloomConfig ¶ added in v2.3.5
type BloomConfig struct { // Enable bloom filter or not. Enable bool `mapstructure:"enable"` // the path to store bloom filter data, {DumpPath}/{chainID}/bloom.dump DumpPath string `mapstructure:"dump_path"` //KeysCapacity bloom filter keys capacity KeysCapacity uint `mapstructure:"keys_capacity"` //FalsePositiveRate bloom filter false positive rate FalsePositiveRate float64 `mapstructure:"false_positive_rate"` // the frequency of dumping bloom filter data to file. DumpPerBlocksCommitted int `mapstructure:"dump_per_blocks_committed"` // Dump data or not when close the bloom filter. DumpWhenClose bool `mapstructure:"dump_when_close"` }
BloomConfig config for create bloom filter
type CacheConfig ¶ added in v2.2.0
type CacheConfig struct { //Cache提供方,包括:bigcache,redis,等 Provider string `mapstructure:"provider"` // Time after which entry can be evicted LifeWindow time.Duration `mapstructure:"life_window"` // Interval between removing expired entries (clean up). // If set to <= 0 then no action is performed. //Setting to < 1 second is counterproductive — bigcache has a one second resolution. CleanWindow time.Duration `mapstructure:"clean_window"` // Max size of entry in bytes. Used only to calculate initial size for cache shards. MaxEntrySize int `mapstructure:"max_entry_size"` // Max size of cache. HardMaxCacheSize int `mapstructure:"hard_max_cache_size"` }
CacheConfig cache config option
@Description:
type DbConfig ¶
type DbConfig struct { //leveldb,badgerdb,tikvdb,sql Provider string `mapstructure:"provider"` LevelDbConfig map[string]interface{} `mapstructure:"leveldb_config"` BadgerDbConfig map[string]interface{} `mapstructure:"badgerdb_config"` TikvDbConfig map[string]interface{} `mapstructure:"tikvdb_config"` SqlDbConfig map[string]interface{} `mapstructure:"sqldb_config"` BloomConfig *BloomConfig `mapstructure:"bloom_config"` }
DbConfig encapsulate db config
@Description:
func (*DbConfig) EnableBloom ¶ added in v2.3.5
EnableBloom whether enable bloom.
func (*DbConfig) GetDbConfig ¶
GetDbConfig get concrete db config according to type
@Description: @receiver c @return map[string]interface{}
func (*DbConfig) IsKVDB ¶
IsKVDB check db satisfy kv standard
@Description: @receiver dbc @return bool
type HistoryDbConfig ¶ added in v2.2.0
type HistoryDbConfig struct { DbConfig `mapstructure:",squash"` DisableKeyHistory bool `mapstructure:"disable_key_history"` DisableContractHistory bool `mapstructure:"disable_contract_history"` DisableAccountHistory bool `mapstructure:"disable_account_history"` }
HistoryDbConfig config history db
@Description:
func NewHistoryDbConfig ¶ added in v2.2.0
func NewHistoryDbConfig(config *DbConfig) *HistoryDbConfig
NewHistoryDbConfig 创建historydb config
@Description: @param config @return *HistoryDbConfig
type StorageConfig ¶
type StorageConfig struct { //默认的Leveldb配置,如果每个DB有不同的设置,可以在自己的DB中进行设置 StorePath string `mapstructure:"store_path"` BlockStoreTmpPath string `mapstructure:"block_store_tmp_path"` //写入区块数据存储方式,0-wal和db双写,1-只写wal,2-只写db //BlockDbType uint8 `mapstructure:"block_db_type"` DbPrefix string `mapstructure:"db_prefix"` WriteBufferSize int `mapstructure:"write_buffer_size"` BloomFilterBits int `mapstructure:"bloom_filter_bits"` BlockWriteBufferSize int `mapstructure:"block_write_buffer_size"` //数据库模式:light只存区块头,normal存储区块头和交易以及生成的State,full存储了区块头、交易、状态和交易收据(读写集、日志等) //Mode string `mapstructure:"mode"` DisableBlockFileDb bool `mapstructure:"disable_block_file_db"` DisableHistoryDB bool `mapstructure:"disable_historydb"` DisableResultDB bool `mapstructure:"disable_resultdb"` DisableContractEventDB bool `mapstructure:"disable_contract_eventdb"` DisableStateCache bool `mapstructure:"disable_state_cache"` EnableBigFilter bool `mapstructure:"enable_bigfilter"` LogDBSegmentAsync bool `mapstructure:"logdb_segment_async"` LogDBSegmentSize int `mapstructure:"logdb_segment_size"` DisableLogDBMmap bool `mapstructure:"disable_logdb_mmap"` ReadBFDBTimeOut int64 `mapstructure:"read_bfdb_timeout"` BlockDbConfig *DbConfig `mapstructure:"blockdb_config"` StateDbConfig *DbConfig `mapstructure:"statedb_config"` HistoryDbConfig *HistoryDbConfig `mapstructure:"historydb_config"` ResultDbConfig *DbConfig `mapstructure:"resultdb_config"` ContractEventDbConfig *DbConfig `mapstructure:"contract_eventdb_config"` TxExistDbConfig *DbConfig `mapstructure:"txexistdb_config"` UnArchiveBlockHeight uint64 `mapstructure:"unarchive_block_height"` ArchiveCheckInterval uint `mapstructure:"archive_check_interval"` RestoreInterval uint `mapstructure:"restore_interval"` Async bool `mapstructure:"is_async"` WriteBatchSize uint64 `mapstructure:"write_batch_size"` Encryptor string `mapstructure:"encryptor"` //SM4 AES EncryptKey string `mapstructure:"encrypt_key"` WriteBlockType int `mapstructure:"write_block_type"` //0 普通写, 1 高速写 StateCache *CacheConfig `mapstructure:"state_cache_config"` BigFilter *BigFilterConfig `mapstructure:"bigfilter_config"` RollingWindowCacheCapacity uint64 `mapstructure:"rolling_window_cache_capacity"` EnableRWC bool `mapstructure:"enable_rwc"` //记录慢操作的日志,默认是0,表示不记录,如果>0则是毫秒数,大于该毫秒数的读操作被记录 SlowLog int64 `mapstructure:"slow_log"` }
StorageConfig engine config
@Description:
func NewStorageConfig ¶ added in v2.2.0
func NewStorageConfig(cfg map[string]interface{}) (*StorageConfig, error)
NewStorageConfig new storage config from map structure
@Description: @param cfg @return *StorageConfig @return error
func (*StorageConfig) GetActiveDBCount ¶
func (config *StorageConfig) GetActiveDBCount() int
GetActiveDBCount 根据配置的DisableDB的情况,确定当前配置活跃的数据库数量
@Description: @receiver config @return int
func (*StorageConfig) GetBlockDbConfig ¶
func (config *StorageConfig) GetBlockDbConfig() *DbConfig
GetBlockDbConfig 返回blockdb config
@Description: @receiver config @return *DbConfig
func (*StorageConfig) GetContractEventDbConfig ¶
func (config *StorageConfig) GetContractEventDbConfig() *DbConfig
GetContractEventDbConfig 返回contractdb config
@Description: @receiver config @return *DbConfig
func (*StorageConfig) GetDefaultDBConfig ¶
func (config *StorageConfig) GetDefaultDBConfig() *DbConfig
GetDefaultDBConfig 返回一个默认config
@Description: @receiver config @return *DbConfig
func (*StorageConfig) GetHistoryDbConfig ¶
func (config *StorageConfig) GetHistoryDbConfig() *HistoryDbConfig
GetHistoryDbConfig 返回historydb config
@Description: @receiver config @return *HistoryDbConfig
func (*StorageConfig) GetResultDbConfig ¶
func (config *StorageConfig) GetResultDbConfig() *DbConfig
GetResultDbConfig 返回resultdb config
@Description: @receiver config @return *DbConfig
func (*StorageConfig) GetStateDbConfig ¶
func (config *StorageConfig) GetStateDbConfig() *DbConfig
GetStateDbConfig 返回statedb config
@Description: @receiver config @return *DbConfig
func (*StorageConfig) GetTxExistDbConfig ¶ added in v2.2.0
func (config *StorageConfig) GetTxExistDbConfig() *DbConfig
GetTxExistDbConfig 返回txExistdb config
@Description: @receiver config @return *DbConfig