1 Star 0 Fork 0

13683679291/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
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mmcro/fabric.git
git@gitee.com:mmcro/fabric.git
mmcro
fabric
fabric
v1.4.1-rc1

搜索帮助

0d507c66 1850385 C8b1a773 1850385