代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ledgerconfig
import (
"path/filepath"
"github.com/hyperledger/fabric/core/config"
"github.com/spf13/viper"
)
//IsCouchDBEnabled exposes the useCouchDB variable
func IsCouchDBEnabled() bool {
stateDatabase := viper.GetString("ledger.state.stateDatabase")
if stateDatabase == "CouchDB" {
return true
}
return false
}
// GetRootPath returns the filesystem path.
// All ledger related contents are expected to be stored under this path
func GetRootPath() string {
sysPath := config.GetPath("peer.fileSystemPath")
return filepath.Join(sysPath, "ledgersData")
}
// GetLedgerProviderPath returns the filesystem path for stroing ledger ledgerProvider contents
func GetLedgerProviderPath() string {
return filepath.Join(GetRootPath(), "ledgerProvider")
}
// GetStateLevelDBPath returns the filesystem path that is used to maintain the state level db
func GetStateLevelDBPath() string {
return filepath.Join(GetRootPath(), "stateLeveldb")
}
// GetHistoryLevelDBPath returns the filesystem path that is used to maintain the history level db
func GetHistoryLevelDBPath() string {
return filepath.Join(GetRootPath(), "historyLeveldb")
}
// GetBlockStorePath returns the filesystem path that is used for the chain block stores
func GetBlockStorePath() string {
return filepath.Join(GetRootPath(), "chains")
}
// GetMaxBlockfileSize returns maximum size of the block file
func GetMaxBlockfileSize() int {
return 64 * 1024 * 1024
}
//GetQueryLimit exposes the queryLimit variable
func GetQueryLimit() int {
queryLimit := viper.GetInt("ledger.state.couchDBConfig.queryLimit")
// if queryLimit was unset, default to 10000
if !viper.IsSet("ledger.state.couchDBConfig.queryLimit") {
queryLimit = 10000
}
return queryLimit
}
//IsHistoryDBEnabled exposes the historyDatabase variable
func IsHistoryDBEnabled() bool {
return viper.GetBool("ledger.history.enableHistoryDatabase")
}
// IsQueryReadsHashingEnabled enables or disables computing of hash
// of range query results for phantom item validation
func IsQueryReadsHashingEnabled() bool {
return true
}
// GetMaxDegreeQueryReadsHashing return the maximum degree of the merkle tree for hashes of
// of range query results for phantom item validation
// For more details - see description in kvledger/txmgmt/rwset/query_results_helper.go
func GetMaxDegreeQueryReadsHashing() uint32 {
return 50
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。