-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Categorise chaincode operations by peer and gateway (#194)
Previous implementation was standalone functions, with all requiring both a gRPC connection and a client signing identity. This required: - An underisably large number of prameters. - Unwritten conventions on parameter ordering. - Documentation comments to highlight when the connection should be to a specific peer or to an organization gateway. - Duplication of arguments across multiple functions for calling code driving the chaincode lifecycle. This implementation defines a Peer and Gateway struct that hold a gRPC connection and a client identity. Each of these types defines methods appropriate to their logical role to: - Avoid the need to provide gRPC connection and client identity arguments on every call. - Provide calling code with logical context for what they are interacting with. - Allow IDE code completion to suggest appropriate methods for the connection type. For example, this pseudo-code flow: chaincode.Install(ctx, peerConnection, id, chaincodePackage) chaincode.Approve(ctx, gatewayConnection, id, chaincodeDefinition) chaincode.Commit(ctx, gatewayConnection, id, chaincodeDefinition) becomes: peer.Install(ctx, chaincodePackage) gateway.Approve(ctx, chaincodeDefinition) gateway.Commit(ctx, chaincodeDefinition) Signed-off-by: Mark S. Lewis <[email protected]>
- Loading branch information
1 parent
b61ba94
commit 29e9edb
Showing
30 changed files
with
747 additions
and
736 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 was deleted.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package chaincode | ||
package chaincode_test | ||
|
||
import ( | ||
"testing" | ||
|
This file was deleted.
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
Oops, something went wrong.