-
Notifications
You must be signed in to change notification settings - Fork 106
Introducing interfaces for new Batching API #692
Introducing interfaces for new Batching API #692
Conversation
Codecov Report
@@ Coverage Diff @@
## master #692 +/- ##
===========================================
+ Coverage 75.46% 75.77% +0.3%
- Complexity 1037 1056 +19
===========================================
Files 196 198 +2
Lines 4675 4805 +130
Branches 363 371 +8
===========================================
+ Hits 3528 3641 +113
- Misses 986 1000 +14
- Partials 161 164 +3
Continue to review full report at Codecov.
|
@igorbernstein2 @sduskis |
Thanks for working on this! For example: // Intended usage for MutateRows:
// Bigtable developer will implement a BatchingDescriptor:
class BigtableDescriptor implements BatchingDescriptor {
// ...
}
// Then they will build a BatcherFactory like so:
// ....
// This factory will be exposed the end user and they will use it to create a batcher like so:
// ..
// Implementation details:
// This is the user visible entrypoint for batching.
class BatcherFactory {
Batcher createBatcher();
}
// This is the user visible batching context. It will transparently create many batches from the added entries delineated by the thresholds configured in batching settings
class Batcher<EntryT, EntryResultT> {
ApiFuture<EntryResultT> add(EntryT entry);
// ...
void flush();
//. ..
}
// This is an internal class that represents an open Batch, it's used to accumulate entries before they are flushed as a batch
class BatchAccumulator {
// ...
} General feedback:
Is this implementation intended for bigtable? If so, I think it would be better to move discussion to bigtable's gaxx package. |
671e6f5
to
e4f0f11
Compare
Codecov Report
@@ Coverage Diff @@
## master #692 +/- ##
=========================================
Coverage 75.74% 75.74%
Complexity 1041 1041
=========================================
Files 196 196
Lines 4679 4679
Branches 363 363
=========================================
Hits 3544 3544
Misses 975 975
Partials 160 160 Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #692 +/- ##
===========================================
+ Coverage 75.46% 75.77% +0.3%
- Complexity 1037 1056 +19
===========================================
Files 196 198 +2
Lines 4675 4805 +130
Branches 363 371 +8
===========================================
+ Hits 3528 3641 +113
- Misses 986 1000 +14
- Partials 161 164 +3
Continue to review full report at Codecov.
|
6ae98b0
to
f126cda
Compare
## What this PR contain This contains interfaces required to perform batching with elements(`MutateRowsRequest.Entry` or `LogEntry`) object directly instead of RequestWrappers(`MutateRowsRequest` or `WriteLogEntriesRequest`).
f126cda
to
cd61543
Compare
@igorbernstein2 please have a look and let me know your thoughts on this. |
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Outdated
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Outdated
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/RequestBuilder.java
Outdated
Show resolved
Hide resolved
@igorbernstein2 Thanks a lot for detailed review comments. I have addressed them in the last commit. |
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
@vam-google Do you mind taking a look before I merge this? |
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Outdated
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Outdated
Show resolved
Hide resolved
gax/src/main/java/com/google/api/gax/batching/v2/BatchingDescriptor.java
Show resolved
Hide resolved
@igorbernstein2 Basically LGTM with several comments. My only real concern is the naming of th 4 type params in |
Have updated type names to increase user understanding by their name. Address some sample changes according to feedback.
@vam-google @igorbernstein2 |
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
removed return statement
@igorbernstein2 Please take a fresh review, If looks good then please merge. |
* } | ||
* }</pre> | ||
* | ||
* @param <ElementT> The request type to perform batching. |
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.
@param <ElementT> the type of each individual element to be batched
@param <ElementResultT> the type of the result for each individual element
@param <RequestT> the type of the request that will contain the accumulated elements
@param <ResponseT> the type of the response will be unpacked into the individual element results
* generated by the gapic-generator. | ||
* | ||
* @param <ElementT> The request type to perform batching. | ||
* @param <RequestT> The request wrapper type which bundles {@link ElementT}. |
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.
Please use the javadoc suggestion from above
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 after the javadoc tweak
@igorbernstein2 |
Just noticed that the ‘@BetaApi’ annotations are missing. Please add them in a follow up pr |
What this PR contains
Introducing new Batcher API, which gives an option to perform batching with element object(eg. for bigtable
MutateRowsRequest.Entry
or for loggingLogEntry
) directly instead of Request wrappers. This returns a future of result/response(eg. for bigtableMutateRowsResponse.Entry
or for loggingVoid
type) corresponding to each element, which would resolve once the batching is finished.