localconf

package module
v0.0.0-...-d23aee0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

localconf

介绍

perseus 链本地配置

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

View Source
const (
	DefaultRpcMaxSendMsgSize = 10 * 1024 * 1024 // 10 MiB
	DefaultRpcMaxRecvMsgSize = 10 * 1024 * 1024 // 10 MiB
)

Variables

View Source
var (

	// FindNewBlockChainNotifyC is the chan for finding new block chain configs.
	FindNewBlockChainNotifyC = make(chan string)
	// ChainMakerConfig is the CMConfig instance for global.
	ChainMakerConfig = &CMConfig{StorageConfig: map[string]interface{}{}}
)
View Source
var (
	//ConfigFilepath 配置文件的路径,默认为当前文件夹的 perseus.yml 文件
	ConfigFilepath = "./perseus.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

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

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         map[string]interface{} `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

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

type CuckooConfig

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

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

type RulesConfig

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

RulesConfig birds

type ShardingBirdsNestConfig

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

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

SnapshotSerializerConfig Snapshot serializer config

type TimedSerializeIntervalConfig

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

TimedSerializeIntervalConfig Timed serialization interval

type TxFilterConfig

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

Jump to

Keyboard shortcuts

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