-
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-6070] Add orderer capabilities structures
Certain capabilities may be required of the orderer which are not required by the rest of the system. For instance, changing the way a channel creation request is validated would have an affect on ordering, but should not have an effect on processing by the peer. This CR adds structures to support this. Change-Id: I4a94a1b8f657f0b56296801672a02717d2162f9a Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
- Loading branch information
Jason Yellick
committed
Sep 28, 2017
1 parent
ed2912c
commit 79a0119
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
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 ( | ||
ordererTypeName = "Orderer" | ||
) | ||
|
||
// OrdererProvider provides capabilities information for orderer level config. | ||
type OrdererProvider struct { | ||
*registry | ||
} | ||
|
||
// NewOrdererProvider creates an orderer capabilities provider. | ||
func NewOrdererProvider(capabilities map[string]*cb.Capability) *OrdererProvider { | ||
cp := &OrdererProvider{} | ||
cp.registry = newRegistry(cp, capabilities) | ||
return cp | ||
} | ||
|
||
// Type returns a descriptive string for logging purposes. | ||
func (cp *OrdererProvider) Type() string { | ||
return ordererTypeName | ||
} | ||
|
||
// HasCapability returns true if the capability is supported by this binary. | ||
func (cp *OrdererProvider) HasCapability(capability string) bool { | ||
switch capability { | ||
// Add new capability names here | ||
default: | ||
return false | ||
} | ||
} |