conf

package
v0.0.0-...-8b03266 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CommonWriteBlockType     = 0
	QuickWriteBlockType      = 1
	DbconfigProviderSql      = "sql"
	DbconfigProviderSqlKV    = "sqlkv" //虽然是用SQL数据库,但是当KV数据库使
	DbconfigProviderLeveldb  = "leveldb"
	DbconfigProviderMemdb    = "memdb" //内存数据库,只用于测试
	DbconfigProviderBadgerdb = "badgerdb"
	DbconfigProviderTikvdb   = "tikvdb"
)
View Source
const SqldbconfigSqldbtypeMysql = "mysql"
View Source
const SqldbconfigSqldbtypeSqlite = "sqlite"

Variables

This section is empty.

Functions

This section is empty.

Types

type BigFilterConfig

type BigFilterConfig struct {
	RedisHosts string  `mapstructure:"redis_hosts_port"`
	Pass       string  `mapstructure:"redis_password"`
	TxCapacity uint    `mapstructure:"tx_capacity"`
	FpRate     float64 `mapstructure:"fp_rate"`
}

bigfilter 配置信息

type CacheConfig

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"`
}

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"`
}

func (*DbConfig) GetDbConfig

func (c *DbConfig) GetDbConfig() map[string]interface{}

func (*DbConfig) IsKVDB

func (dbc *DbConfig) IsKVDB() bool

func (*DbConfig) IsSqlDB

func (dbc *DbConfig) IsSqlDB() bool

type HistoryDbConfig

type HistoryDbConfig struct {
	DbConfig               `mapstructure:",squash"`
	DisableKeyHistory      bool `mapstructure:"disable_key_history"`
	DisableContractHistory bool `mapstructure:"disable_contract_history"`
	DisableAccountHistory  bool `mapstructure:"disable_account_history"`
}

func NewHistoryDbConfig

func NewHistoryDbConfig(config *DbConfig) *HistoryDbConfig

创建historydb config

type StorageConfig

type StorageConfig struct {
	//默认的Leveldb配置,如果每个DB有不同的设置,可以在自己的DB中进行设置
	StorePath string `mapstructure:"store_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"`
	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"`
	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"`
}

func NewStorageConfig

func NewStorageConfig(cfg map[string]interface{}) (*StorageConfig, error)

NewStorageConfig new storage config from map structure

func (*StorageConfig) GetActiveDBCount

func (config *StorageConfig) GetActiveDBCount() int

GetActiveDBCount 根据配置的DisableDB的情况,确定当前配置活跃的数据库数量

func (*StorageConfig) GetBlockDbConfig

func (config *StorageConfig) GetBlockDbConfig() *DbConfig

返回blockdb config

func (*StorageConfig) GetContractEventDbConfig

func (config *StorageConfig) GetContractEventDbConfig() *DbConfig

返回contractdb config

func (*StorageConfig) GetDefaultDBConfig

func (config *StorageConfig) GetDefaultDBConfig() *DbConfig

返回一个默认config

func (*StorageConfig) GetHistoryDbConfig

func (config *StorageConfig) GetHistoryDbConfig() *HistoryDbConfig

返回historydb config

func (*StorageConfig) GetResultDbConfig

func (config *StorageConfig) GetResultDbConfig() *DbConfig

返回resultdb config

func (*StorageConfig) GetStateDbConfig

func (config *StorageConfig) GetStateDbConfig() *DbConfig

返回statedb config

func (*StorageConfig) GetTxExistDbConfig

func (config *StorageConfig) GetTxExistDbConfig() *DbConfig

返回txExistdb config

Jump to

Keyboard shortcuts

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