feat: enhancement for Batcher api to address bulk read #833
Conversation
Codecov Report
@@ Coverage Diff @@
## master #833 +/- ##
============================================
- Coverage 78.73% 78.62% -0.11%
- Complexity 1151 1163 +12
============================================
Files 202 203 +1
Lines 5107 5142 +35
Branches 407 413 +6
============================================
+ Hits 4021 4043 +22
- Misses 913 925 +12
- Partials 173 174 +1
Continue to review full report at Codecov.
|
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.
I don't love this approach. You are passing 2 parallel lists to splitResponse: elements
and batch
and you are updating the surface for 2 classes.
I think it would be cleaner for splitResponse to take a list of Entries, which contain the original element and its corresponding unresolved ApiFuture.
Thanks a lot for the suggestion. I have tried to implement the approach you mentioned. Could you please take a look. |
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.
This is looking good. Can you convert the class to use AutoValue and publish this as a PR?
This commit contains enhancements to BatcherAPI. Currently there is no ways to know input user has sent in BatchingDescriptor. There is a better chance that in case of duplicated/non-existenting input server would only sent response for unique elements. After this change the elements sent for batching would be available to user inside BatchingDescriptor.
…ntry BatchEntry would contain input element and it's corresponded result future.
e99ad37
to
0e01126
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.
This is looking good. @kolea2 can you take a pass as well?
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.
LGTM except the nit
This commit contains enhancements to BatcherAPI.
Currently, there is no ways to know the input user has sent in BatchingDescriptor. There is a good chance that in case of duplicated/non-existing input, the server would only send responses for unique elements.
After this change, the elements sent for batching would be available to the user inside BatchingDescriptor#splitResponse.