-
Notifications
You must be signed in to change notification settings - Fork 8.8k
/
nopcollection.go
46 lines (35 loc) · 983 Bytes
/
nopcollection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package privdata
import (
"github.com/hyperledger/fabric/protos/common"
"github.com/spf13/viper"
)
// NopCollection implements an allow-all collection which all orgs are a member of
type NopCollection struct {
}
func (nc *NopCollection) CollectionID() string {
return ""
}
func (nc *NopCollection) MemberOrgs() []string {
return nil
}
func (nc *NopCollection) RequiredPeerCount() int {
return viper.GetInt("peer.gossip.pvtData.minPeers")
}
func (nc *NopCollection) AccessFilter() Filter {
// return true for all
return func(common.SignedData) bool {
return true
}
}
type NopCollectionStore struct {
}
func (*NopCollectionStore) RetrieveCollection(common.CollectionCriteria) (Collection, error) {
return &NopCollection{}, nil
}
func (*NopCollectionStore) RetrieveCollectionAccessPolicy(common.CollectionCriteria) (CollectionAccessPolicy, error) {
return &NopCollection{}, nil
}