-
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-5264] Move interfaces from multichannel
The multichannel (formerly multichain) package became a bit of a dumping ground for all of the interface definitions used in the orderer system. this makes the multichannel package clunky, difficult to mock, and encourages poor separation between components. This CR extracts the interface definitions and moves them to more sensible locations based on the natural separation of function within the orderer codebase. It is also fixed the multichannel package to generally return pointers to structs, rather than to interfaces, following the golang best practice of accepting interfaces and returning structs. Change-Id: Iaf004e1dadf7bf92d106bd7c90f244e0089b9924 Signed-off-by: Jason Yellick <[email protected]>
- Loading branch information
Jason Yellick
committed
Jul 26, 2017
1 parent
d6b54c8
commit 9b1490e
Showing
17 changed files
with
283 additions
and
243 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,42 @@ | ||
/* | ||
Copyright IBM Corp. 2017 All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// Package msgprocessor provides the implementations for processing of the assorted message | ||
// types which may arrive in the system through Broadcast. | ||
package msgprocessor | ||
|
||
import ( | ||
cb "github.com/hyperledger/fabric/protos/common" | ||
) | ||
|
||
// Classification represents the possible message types for the system. | ||
type Classification int | ||
|
||
const ( | ||
// NormalMsg is the class of standard (endorser or otherwise non-config) messages. | ||
// Messages of this type should be processed by ProcessNormalMsg. | ||
NormalMsg Classification = iota | ||
|
||
// ConfigUpdateMsg is the class of configuration related messages. | ||
// Messages of this type should be processed by ProcessConfigUpdateMsg. | ||
ConfigUpdateMsg | ||
) | ||
|
||
// Processor provides the methods necessary to classify and process any message which | ||
// arrives through the Broadcast interface. | ||
type Processor interface { | ||
// ClassifyMsg inspects the message to determine which type of processing is necessary | ||
ClassifyMsg(env *cb.Envelope) (Classification, error) | ||
|
||
// ProcessNormalMsg will check the validity of a message based on the current configuration. It returns the current | ||
// configuration sequence number and nil on success, or an error if the message is not valid | ||
ProcessNormalMsg(env *cb.Envelope) (configSeq uint64, err error) | ||
|
||
// ProcessConfigUpdateMsg will attempt to apply the config update to the current configuration, and if successful | ||
// return the resulting config message and the configSeq the config was computed from. If the config update message | ||
// is invalid, an error is returned. | ||
ProcessConfigUpdateMsg(env *cb.Envelope) (config *cb.Envelope, configSeq uint64, err error) | ||
} |
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
Oops, something went wrong.