localconf

package module
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 21

Documentation

Overview

Package localconf record all the values of the local config options.

Index

Constants

View Source
const (
	DefaultRpcMaxSendMsgSize      = 10 * 1024 * 1024 // 10 MiB
	DefaultRpcMaxRecvMsgSize      = 10 * 1024 * 1024 // 10 MiB
	DefaultRpcSyncTxResultTimeout = 60               // 60 seconds
)
View Source
const CustomChainTrustRoots = "CustomChainTrustRoots"

Variables

View Source
var (

	// FindNewBlockChainNotifyC is the chan for finding new block chain configs.
	FindNewBlockChainNotifyC = make(chan string)
	// FindDeleteBlockChainNotifyC is the chan for finding delete block chain configs.
	FindDeleteBlockChainNotifyC = make(chan string)
	// ChainMakerConfig is the CMConfig instance for global.
	ChainMakerConfig = &CMConfig{StorageConfig: map[string]interface{}{}}

	// UpdateSeedsNotifyC notifies when network seed nodes need updating.
	UpdateSeedsNotifyC = make(chan string)
	// UpdateCustomChainTrustRootsNotifyC notifies when custom chain trust roots change.
	UpdateCustomChainTrustRootsNotifyC = make(chan string)
)
View Source
var (
	//ConfigFilepath 配置文件的路径,默认为当前文件夹的chainmaker.yml文件
	ConfigFilepath = "./chainmaker.yml"
)

Functions

func CheckNewCmBlockChainConfig

func CheckNewCmBlockChainConfig() error

func InitLocalConfig

func InitLocalConfig(cmd *cobra.Command) error

InitLocalConfig init local config.

func RefreshLogLevelsConfig

func RefreshLogLevelsConfig() error

RefreshLogLevelsConfig refresh the levels of the loggers with the logger config file.

func UpdateDebugConfig

func UpdateDebugConfig(pairs []*config.ConfigKeyValue) error

UpdateDebugConfig refresh the switches of the debug mode.

Types

type BirdsNestConfig added in v2.2.1

type BirdsNestConfig struct {
	Length uint32 `mapstructure:"length"`
	// Cuckoo config
	Cuckoo CuckooConfig `mapstructure:"cuckoo"`
	// rules config
	Rules RulesConfig `mapstructure:"rules"`
	// Snapshot config
	Snapshot SnapshotSerializerConfig `mapstructure:"snapshot"`
}

BirdsNestConfig birds

type BlockHeightSerializeIntervalConfig added in v2.2.1

type BlockHeightSerializeIntervalConfig struct {
	Interval int `mapstructure:"interval"`
}

BlockHeightSerializeIntervalConfig Timed serialization interval

type BlockchainConfig

type BlockchainConfig struct {
	ChainId string
	Genesis string
}

type CMConfig

type CMConfig struct {
	AuthType         string                 `mapstructure:"auth_type"`
	LogConfig        logger.LogConfig       `mapstructure:"log"`
	NetConfig        netConfig              `mapstructure:"net"`
	NodeConfig       nodeConfig             `mapstructure:"node"`
	RpcConfig        rpcConfig              `mapstructure:"rpc"`
	BlockChainConfig []BlockchainConfig     `mapstructure:"blockchain"`
	ConsensusConfig  ConsensusConfig        `mapstructure:"consensus"`
	StorageConfig    map[string]interface{} `mapstructure:"storage"`
	TxPoolConfig     map[string]interface{} `mapstructure:"txpool"`
	SyncConfig       SyncConfig             `mapstructure:"sync"`
	VMConfig         vmConfig               `mapstructure:"vm"`
	CryptoEngine     string                 `mapstructure:"crypto_engine"`

	// 开发调试使用
	DebugConfig     debugConfig     `mapstructure:"debug"`
	PProfConfig     pprofConfig     `mapstructure:"pprof"`
	MonitorConfig   monitorConfig   `mapstructure:"monitor"`
	CoreConfig      coreConfig      `mapstructure:"core"`
	SchedulerConfig schedulerConfig `mapstructure:"scheduler"`
	TxFilter        TxFilterConfig  `mapstructure:"tx_filter"`
	// contains filtered or unexported fields
}

CMConfig - Local config struct

func (*CMConfig) Deal added in v2.2.0

func (c *CMConfig) Deal()

Deal deal and set the default configuration parameters

func (*CMConfig) GetBlockChains

func (c *CMConfig) GetBlockChains() []BlockchainConfig

GetBlockChains - get blockchain config list

func (*CMConfig) GetP11Handle

func (c *CMConfig) GetP11Handle() (*pkcs11.P11Handle, error)

func (*CMConfig) GetStorePath

func (c *CMConfig) GetStorePath() string

func (*CMConfig) PrettyJson

func (c *CMConfig) PrettyJson() (string, error)

PrettyJson print with json.

func (*CMConfig) SetNodeId

func (c *CMConfig) SetNodeId(nodeId string)

SetNodeId - 设置NodeId

type ConsensusConfig

type ConsensusConfig struct {
	RaftConfig raftConfig `mapstructure:"raft"`
	TbftConfig tbftConfig `mapstructure:"tbft"`
}

type CuckooConfig added in v2.2.1

type CuckooConfig struct {
	KeyType int32 `mapstructure:"key_type"`
	// num of tags for each bucket, which is b in paper. tag is fingerprint, which is f in paper.
	TagsPerBucket uint32 `mapstructure:"tags_per_bucket"`
	// num of bits for each item, which is length of tag(fingerprint)
	BitsPerItem uint32 `mapstructure:"bits_per_item"`
	// num of keys that filter will store. this value should close to and lower
	//					 nextPow2(maxNumKeys/tagsPerBucket) * maxLoadFactor. cause table.NumBuckets is always a power of two
	MaxNumKeys uint32 `mapstructure:"max_num_keys"`
	// has two constant parameters to choose from:
	// TableTypeSingle normal single table
	// TableTypePacked packed table, use semi-sort to save 1 bit per item
	TableType uint32 `mapstructure:"table_type"`
}

CuckooConfig Cuckoo config

type FilterExtensionConfig added in v2.2.1

type FilterExtensionConfig struct {
	// id expire time
	AbsoluteExpireTime int64 `mapstructure:"absolute_expire_time"`
}

type RulesConfig added in v2.2.1

type RulesConfig struct {
	AbsoluteExpireTime int64 `mapstructure:"absolute_expire_time"`
}

RulesConfig birds

type ShardingBirdsNestConfig added in v2.2.1

type ShardingBirdsNestConfig struct {
	Length  uint32 `mapstructure:"length"`
	Timeout int64  `mapstructure:"timeout"`
	// Bird's Nest configuration
	BirdsNest BirdsNestConfig `mapstructure:"birds_nest"`
	// Snapshot config
	Snapshot SnapshotSerializerConfig `mapstructure:"snapshot"`
}

ShardingBirdsNestConfig Sharding bird's Nest configuration

type SnapshotSerializerConfig added in v2.2.1

type SnapshotSerializerConfig struct {
	Type        int
	BlockHeight BlockHeightSerializeIntervalConfig `mapstructure:"block_height"`
	Timed       TimedSerializeIntervalConfig       `mapstructure:"timed"`
	// filepath
	Path string `mapstructure:"path"`
}

SnapshotSerializerConfig Snapshot serializer config

type SyncConfig added in v2.4.0

type SyncConfig struct {
	BroadcastTime             uint32  `mapstructure:"broadcast_time"`
	BlockPoolSize             uint32  `mapstructure:"block_pool_size"`
	WaitTimeOfBlockRequestMsg uint32  `mapstructure:"wait_time_requested"`
	BatchSizeFromOneNode      uint32  `mapstructure:"batch_size_from_one_node"`
	ProcessBlockTick          float64 `mapstructure:"process_block_tick"`
	NodeStatusTick            float64 `mapstructure:"node_status_tick"`
	LivenessTick              float64 `mapstructure:"liveness_tick"`
	SchedulerTick             float64 `mapstructure:"scheduler_tick"`
	ReqTimeThreshold          float64 `mapstructure:"req_time_threshold"`
	DataDetectionTick         float64 `mapstructure:"data_detection_tick"`
	BlockRequestTime          float64 `mapstructure:"block_request_time"`
	// Broadcast its own status once every 'BroadcastStatusPerBlocksCommitted' blocks committed.
	BroadcastStatusPerBlocksCommitted int `mapstructure:"broadcast_status_per_blocks_committed"`

	//the ids of nodes that are preferred to sync from, used in v1 and v2.
	FromNodes []string `mapstructure:"from_nodes"`

	// ConnTimeoutScale is the base time of connection timeout(ms).
	// The timeout for various type of messages is an multiple of this value.
	ConnTimeoutScale uint64 `mapstructure:"conn_timeout_scale"`
	// IdealHeightDistance the difference between the local height has been synchronized and the latest height
	// is within the specified range.
	IdealHeightDistance uint64 `mapstructure:"ideal_height_distance"`
	// WaitPeriodSecondsAfterLatest is the time interval for checking whether there are new blocks
	// to be synced after syncing to the latest block.
	WaitPeriodSecondsAfterLatest uint32 `mapstructure:"wait_period_seconds_after_latest"`
	// MaxNodesSelectedCount is the maximum number of nodes selected for syncing.
	MaxNodesSelectedCount int `mapstructure:"max_nodes_selected_count"`
}

type TimedSerializeIntervalConfig added in v2.2.1

type TimedSerializeIntervalConfig struct {
	Interval int `mapstructure:"interval"`
}

TimedSerializeIntervalConfig Timed serialization interval

type TxFilterConfig added in v2.2.1

type TxFilterConfig struct {
	// Transaction filter type
	Type int32 `mapstructure:"type"`
	// Bird's nest configuration
	BirdsNest BirdsNestConfig `mapstructure:"birds_nest"`
	// Sharding bird's nest configuration
	ShardingBirdsNest ShardingBirdsNestConfig `mapstructure:"sharding"`
}

TxFilterConfig tx filter

Source Files

  • config.go
  • default.go
  • global.go
  • types.go

Jump to

Keyboard shortcuts

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