63 Star 183 Fork 3

Gitee 极速下载/hyperledger-fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/hyperledger/fabric
克隆/下载
config.go 3.04 KB
一键复制 编辑 原始数据 按行查看 历史
senthil 提交于 2019-05-28 14:14 . cache config via core.yaml
/*
Copyright IBM Corp. 2016 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package node
import (
"path/filepath"
coreconfig "github.com/hyperledger/fabric/core/config"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/util/couchdb"
"github.com/spf13/viper"
)
func ledgerConfig() *ledger.Config {
// set defaults
warmAfterNBlocks := 1
if viper.IsSet("ledger.state.couchDBConfig.warmIndexesAfterNBlocks") {
warmAfterNBlocks = viper.GetInt("ledger.state.couchDBConfig.warmIndexesAfterNBlocks")
}
internalQueryLimit := 1000
if viper.IsSet("ledger.state.couchDBConfig.internalQueryLimit") {
internalQueryLimit = viper.GetInt("ledger.state.couchDBConfig.internalQueryLimit")
}
maxBatchUpdateSize := 500
if viper.IsSet("ledger.state.couchDBConfig.maxBatchUpdateSize") {
maxBatchUpdateSize = viper.GetInt("ledger.state.couchDBConfig.maxBatchUpdateSize")
}
collElgProcMaxDbBatchSize := 5000
if viper.IsSet("ledger.pvtdataStore.collElgProcMaxDbBatchSize") {
collElgProcMaxDbBatchSize = viper.GetInt("ledger.pvtdataStore.collElgProcMaxDbBatchSize")
}
collElgProcDbBatchesInterval := 1000
if viper.IsSet("ledger.pvtdataStore.collElgProcDbBatchesInterval") {
collElgProcDbBatchesInterval = viper.GetInt("ledger.pvtdataStore.collElgProcDbBatchesInterval")
}
purgeInterval := 100
if viper.IsSet("ledger.pvtdataStore.purgeInterval") {
purgeInterval = viper.GetInt("ledger.pvtdataStore.purgeInterval")
}
rootFSPath := filepath.Join(coreconfig.GetPath("peer.fileSystemPath"), "ledgersData")
conf := &ledger.Config{
RootFSPath: rootFSPath,
StateDBConfig: &ledger.StateDBConfig{
StateDatabase: viper.GetString("ledger.state.stateDatabase"),
CouchDB: &couchdb.Config{},
},
PrivateDataConfig: &ledger.PrivateDataConfig{
MaxBatchSize: collElgProcMaxDbBatchSize,
BatchesInterval: collElgProcDbBatchesInterval,
PurgeInterval: purgeInterval,
},
HistoryDBConfig: &ledger.HistoryDBConfig{
Enabled: viper.GetBool("ledger.history.enableHistoryDatabase"),
},
}
if conf.StateDBConfig.StateDatabase == "CouchDB" {
conf.StateDBConfig.CouchDB = &couchdb.Config{
Address: viper.GetString("ledger.state.couchDBConfig.couchDBAddress"),
Username: viper.GetString("ledger.state.couchDBConfig.username"),
Password: viper.GetString("ledger.state.couchDBConfig.password"),
MaxRetries: viper.GetInt("ledger.state.couchDBConfig.maxRetries"),
MaxRetriesOnStartup: viper.GetInt("ledger.state.couchDBConfig.maxRetriesOnStartup"),
RequestTimeout: viper.GetDuration("ledger.state.couchDBConfig.requestTimeout"),
InternalQueryLimit: internalQueryLimit,
MaxBatchUpdateSize: maxBatchUpdateSize,
WarmIndexesAfterNBlocks: warmAfterNBlocks,
CreateGlobalChangesDB: viper.GetBool("ledger.state.couchDBConfig.createGlobalChangesDB"),
RedoLogPath: filepath.Join(rootFSPath, "couchdbRedoLogs"),
UserCacheSizeMBs: viper.GetInt("ledger.state.couchDBConfig.cacheSize"),
}
}
return conf
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mirrors/hyperledger-fabric.git
git@gitee.com:mirrors/hyperledger-fabric.git
mirrors
hyperledger-fabric
hyperledger-fabric
v2.0.0-beta

搜索帮助