代码拉取完成,页面将自动刷新
/*
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。