-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "[FAB-5863] Collection-related APIs"
- Loading branch information
Showing
5 changed files
with
143 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package privdata | ||
|
||
import "github.com/hyperledger/fabric/protos/ledger/rwset" | ||
|
||
// SerializedPolicy defines a persisted policy | ||
type SerializedPolicy interface { | ||
// Channel returns the channel this SerializedPolicy corresponds to | ||
Channel() string | ||
// Raw returns the policy in its raw form | ||
Raw() []byte | ||
} | ||
|
||
// SerializedIdentity defines an identity of a network participant | ||
type SerializedIdentity []byte | ||
|
||
// PolicyStore defines an object that retrieves stored SerializedPolicies | ||
// based on the collection's properties | ||
type PolicyStore interface { | ||
// GetPolicy retrieves the collection policy from in the following way: | ||
// If the TxID exists in the ledger, the policy that is returned is the latest policy | ||
// which was committed into the ledger before this txID was committed. | ||
// Else - it's the latest policy for the collection. | ||
CollectionPolicy(rwset.CollectionCriteria) SerializedPolicy | ||
} | ||
|
||
// Filter defines a rule that filters out SerializedIdentities | ||
// that the policy doesn't hold for them. | ||
// Returns: True, if the policy holds for the given SerializedIdentity, | ||
// False otherwise | ||
type Filter func(SerializedIdentity) bool | ||
|
||
// PolicyParser parses SerializedPolicies and returns a Filter | ||
type PolicyParser interface { | ||
// Parse parses a given SerializedPolicy and returns a Filter | ||
// that is derived from it | ||
Parse(SerializedPolicy) Filter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package api | ||
|
||
import "github.com/hyperledger/fabric/gossip/common" | ||
|
||
// RoutingFilter defines which peers should receive a certain message, | ||
// or which peers are eligible of receiving a certain message | ||
type RoutingFilter func(peerIdentity PeerIdentityType) bool | ||
|
||
// CollectionCriteria describes a certain sub-channel, or a part of it | ||
type CollectionCriteria []byte | ||
|
||
// RoutingFilterFactory defines an object that given a CollectionCriteria and a channel, | ||
// it can ascertain which peers should be aware of the data related to the | ||
// CollectionCriteria. | ||
type RoutingFilterFactory interface { | ||
// Peers returns a RoutingFilter for given chainID and CollectionCriteria | ||
Peers(common.ChainID, CollectionCriteria) RoutingFilter | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters