-
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.
[FAB-6071] Add application capabilities structures
Certain capabilities may be required of the peer which are completely irrelevant to the other pieces of the system (such as the orderer). For instance, whether a peer may process side-DB transactions had no impact on the orderer, because the orderer is left out of these transactions by design. This CR adds basic support for application/peer capabilities though none are currently implemented. Change-Id: I27fe1266b370b6d71791c5782bbe641c081e8f62 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
- Loading branch information
Jason Yellick
committed
Sep 28, 2017
1 parent
79a0119
commit 64d1b8e
Showing
2 changed files
with
44 additions
and
0 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,41 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package capabilities | ||
|
||
import ( | ||
cb "github.com/hyperledger/fabric/protos/common" | ||
) | ||
|
||
const ( | ||
applicationTypeName = "Application" | ||
) | ||
|
||
// ApplicationProvider provides capabilities information for application level config. | ||
type ApplicationProvider struct { | ||
*registry | ||
} | ||
|
||
// NewApplicationProvider creates a application capabilities provider. | ||
func NewApplicationProvider(capabilities map[string]*cb.Capability) *ApplicationProvider { | ||
cp := &ApplicationProvider{} | ||
cp.registry = newRegistry(cp, capabilities) | ||
return cp | ||
} | ||
|
||
// Type returns a descriptive string for logging purposes. | ||
func (cp *ApplicationProvider) Type() string { | ||
return applicationTypeName | ||
} | ||
|
||
// HasCapability returns true if the capability is supported by this binary. | ||
func (cp *ApplicationProvider) HasCapability(capability string) bool { | ||
switch capability { | ||
// Add new capability names here | ||
default: | ||
return false | ||
} | ||
} |
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