1 Star 0 Fork 0

小庄 / fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
persistent_msgs_helper.go 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
senthil 提交于 2018-08-28 17:12 . recon: commit oldBlks' pvData to pvtStore
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package pvtdatastorage
func newExpiryData() *ExpiryData {
return &ExpiryData{Map: make(map[string]*Collections)}
}
func (e *ExpiryData) getOrCreateCollections(ns string) *Collections {
collections, ok := e.Map[ns]
if !ok {
collections = &Collections{
Map: make(map[string]*TxNums),
MissingDataMap: make(map[string]bool)}
e.Map[ns] = collections
} else {
// due to protobuf encoding/decoding, the previously
// initialized map could be a nil now due to 0 length.
// Hence, we need to reinitialize the map.
if collections.Map == nil {
collections.Map = make(map[string]*TxNums)
}
if collections.MissingDataMap == nil {
collections.MissingDataMap = make(map[string]bool)
}
}
return collections
}
func (e *ExpiryData) addPresentData(ns, coll string, txNum uint64) {
collections := e.getOrCreateCollections(ns)
txNums, ok := collections.Map[coll]
if !ok {
txNums = &TxNums{}
collections.Map[coll] = txNums
}
txNums.List = append(txNums.List, txNum)
}
func (e *ExpiryData) addMissingData(ns, coll string) {
collections := e.getOrCreateCollections(ns)
collections.MissingDataMap[coll] = true
}
func newCollElgInfo(nsCollMap map[string][]string) *CollElgInfo {
m := &CollElgInfo{NsCollMap: map[string]*CollNames{}}
for ns, colls := range nsCollMap {
collNames, ok := m.NsCollMap[ns]
if !ok {
collNames = &CollNames{}
m.NsCollMap[ns] = collNames
}
collNames.Entries = colls
}
return m
}
1
https://gitee.com/zhuanglicheng/fabric.git
git@gitee.com:zhuanglicheng/fabric.git
zhuanglicheng
fabric
fabric
v2.1.1

搜索帮助