-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Anchor peer API and other refractoring #120
Introduce Anchor peer API and other refractoring #120
Conversation
f827021
to
fa17182
Compare
Signed-off-by: n0s09by <[email protected]>
fa17182
to
f0f3000
Compare
src/main/java/hlf/java/rest/client/service/AddAnchorPeerToChannelWriteSetBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/hlf/java/rest/client/service/impl/NetworkStatusImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/hlf/java/rest/client/service/impl/NetworkStatusImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/hlf/java/rest/client/controller/FabricOperationsController.java
Show resolved
Hide resolved
src/main/java/hlf/java/rest/client/service/impl/AddAnchorPeerToChannelWriteSetBuilderImpl.java
Outdated
Show resolved
Hide resolved
…ew other refractor Signed-off-by: n0s09by <[email protected]>
src/main/java/hlf/java/rest/client/model/AnchorPeerParamsDTO.java
Outdated
Show resolved
Hide resolved
d6775ed
to
1cf1c7c
Compare
Signed-off-by: n0s09by <[email protected]>
1cf1c7c
to
96f772d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, there's possibility of removing duplicate code.
@PostMapping(value = "/channel/{channelName}/add_anchor_peer") | ||
public ResponseEntity<ClientResponseModel> addAnchorPeersToChannel( | ||
@PathVariable @Validated String channelName, | ||
@RequestBody @Validated ChannelUpdateParamsDTO channelUpdateParamsDTO) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick/question] Will it make it simple to have one channel update API with different query parameter to do different activities? The other inputs to the API remain the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How I visual this - two operations that requires channel update are performed at different time, like one is done to add new organization to the channel and the other - to add anchor peers to a channel is done once the peer has joined the channel. It is good to keep them as separate since these are entirely different operation and most importantly, impacting the different sections in the config block.
If we see a need to merge them in the future - by introducing more scenarios that require config block update, we could do it.
MessageOrBuilder message = configUpdate; | ||
String channelConfigString = JsonFormat.printer().print(message); | ||
ConfigUpdate configUpdate = createConfigUpdate(channelName, organizationDetails); | ||
String channelConfigString = JsonFormat.printer().print(configUpdate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] The method getDeserializedConfig
appears to be doing this task with the exception handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing logic was to print it as string and use it further, kept the logic as in. The getDeserializedConfig
method returns the Base64 encoded characters.
try { | ||
Channel selectedChannel = network.getChannel(); | ||
ConfigUpdate configUpdate = createConfigUpdate(channelName, channelUpdateParamsDTO); | ||
String channelConfigString = JsonFormat.printer().print(configUpdate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] The method getDeserializedConfig
appears to be doing this task with the exception handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getDeserializedConfig
method returns the Base64 encoded characters. Here we are interested in converting a protobuf message to JSON format, that's why didn't reuse the method.
No description provided.