-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Allow the peer delivery client to select policy #4856
Conversation
b7416c0
to
aebff31
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 overall. Just a few minor comments.
We'll need to add an integration test that checks that this indeed works (another PR). We can use the same approach is in the orderer.ReplicationPolicy: copy a simple test from the smartbft test suite (that uses a peer) and simply change to Policy="simple".
core/deliverservice/config.go
Outdated
@@ -52,6 +54,7 @@ type DeliverServiceConfig struct { | |||
// OrdererEndpointOverrides is a map of orderer addresses which should be | |||
// re-mapped to a different orderer endpoint. | |||
OrdererEndpointOverrides map[string]*orderers.Endpoint | |||
Policy string |
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.
Add comment with an explanation, same as in the yaml file.
case "BFT": | ||
d.blockDeliverer, err = d.createBlockDelivererBFT(chainID, ledgerInfo) | ||
switch d.conf.DeliverServiceConfig.Policy { | ||
case "cluster", "": |
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.
at this stage the policy should not be "", as we det the default "cluster" much earlier.
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.
it is needed for the unit tests, they do not go through the code that "patches" this case, so we need the code here in the delivery client itself.
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.
Yes, but it unit test you should check that if the policy is not set you get an error... IMO
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.
fixed :)
if createCftDeliverer { | ||
d.blockDeliverer, err = d.createBlockDelivererCFT(chainID, ledgerInfo) | ||
} |
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.
why not simply call this function from 2 places? it will save 4 line of code, no? (and would be more readable in my opinion).
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.
correct :)
fa34b0a
to
2f799e2
Compare
b77e65d
to
a3987ba
Compare
…Delivere Signed-off-by: Emil Elizarov <emil.elizarov@ibm.com>
Signed-off-by: Yoav Tock <tock@il.ibm.com>
Type of change
Description
Issue: #4847
Related issues
#4847