-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-9724] Validation plugin infrastructure support
This change set adds support to the handlers to load validation plugins. Change-Id: I1cbf29bfe8899a43569a67d830c21d6f3b67d833 Signed-off-by: yacovm <yacovm@il.ibm.com>
- Loading branch information
Showing
3 changed files
with
114 additions
and
7 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
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 main | ||
|
||
import ( | ||
"github.com/hyperledger/fabric/core/handlers/validation/api" | ||
"github.com/hyperledger/fabric/protos/common" | ||
) | ||
|
||
// NoOpValidator is used to test validation plugin infrastructure | ||
type NoOpValidator struct { | ||
} | ||
|
||
// Validate valides the transactions with the given data | ||
func (*NoOpValidator) Validate(_ *common.Block, _ string, _ int, _ int, _ ...validation.ContextDatum) error { | ||
return nil | ||
} | ||
|
||
// Init initializes the plugin with the given dependencies | ||
func (*NoOpValidator) Init(dependencies ...validation.Dependency) error { | ||
return nil | ||
} | ||
|
||
// NoOpValidatorFactory creates new NoOpValidators | ||
type NoOpValidatorFactory struct { | ||
} | ||
|
||
// New returns an instance of a NoOpValidator | ||
func (*NoOpValidatorFactory) New() validation.Plugin { | ||
return &NoOpValidator{} | ||
} | ||
|
||
// NewPluginFactory is called by the validation plugin framework to obtain an instance | ||
// of the factory | ||
func NewPluginFactory() validation.PluginFactory { | ||
return &NoOpValidatorFactory{} | ||
} |