Uh oh!
There was an error while loading. Please reload this page.
WIP: Server streaming callable improvements - #403
Conversation
e8863d1 to
40a8843Compareigorbernstein2
commented
Nov 1, 2017
rebased |
Codecov Report
@@ Coverage Diff @@## master #403 +/- ##
============================================
+ Coverage 70.53% 71.38% +0.85% - Complexity 634 680 +46
============================================
Files 136 143 +7 Lines 2912 3334 +422 Branches 220 265 +45 ============================================
+ Hits 2054 2380 +326 - Misses 776 846 +70 - Partials 82 108 +26
Continue to review full report at Codecov.
|
garrettjonesgoogle
left a comment
There was a problem hiding this comment.
I haven't looked very deeply yet, but I would recommend merging from master sooner than later because I committed a large refactoring that will conflict with yours.
| * disable automatic flow control. The receiver can also save a reference to the instance and | ||
| * terminate the stream early using {@code cancel()}. | ||
| */ | ||
| abstract class StreamController { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
garrettjonesgoogle
commented
Nov 2, 2017
Sorry I spoke too soon, you already rebased :-) |
9ca1217 to
4c6b90fCompare
garrettjonesgoogle
left a comment
There was a problem hiding this comment.
Overall I like how this is turning out.
| * Wraps a GRPC ClientCall in a {@link StreamController}. It feeds events to a {@link | ||
| * ResponseObserver} and allows for back pressure. | ||
| */ | ||
| static class GrpcStreamController<RequestT, ResponseT> extends StreamController { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * control by calling {@code disableAutoInboundFlowControl()} in {@code onStart}. After which, the | ||
| * consumer must request responses by calling {@code request()}. | ||
| */ | ||
| public interface ResponseObserver<V> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * | ||
| * <p>By default, the stream uses automatic flow control, where the next response will be delivered | ||
| * as soon as the current one is processed by onResponse. A consumer can disable automatic flow | ||
| * control by calling {@code disableAutoInboundFlowControl()} in {@code onStart}. After which, the |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * <p>Can be called many times but is never called after {@link #onError(Throwable)} or {@link | ||
| * #onComplete()} are called. | ||
| * | ||
| * <p>Clients may may receive 0 or more onNext callbacks. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
igorbernstein2
commented
Nov 3, 2017
Ok, I'll apply those changes & break this up into smaller chunks to make it easier to review:
|
This introduces a richer callback interface `ResponseListener` that can be passed to ServerStreamingCallables. It allows the user to disable automatic flow control.
This allows the ServerStreamingCallables to be easily composable and allows the calls to be cleanly cancelled.
…ynchronization simplification
ab56d25 to
aa5dca1Compare
This is not ready for merging, its an early draft.
This is a rough draft of the ServerStreamingCallable api improvements that @garrettjonesgoogle & I were discussing. This PR is meant to get some early feedback on implementation direction and a sanity check. The code needs a lot of debugging, clean up, tests & doc but its feature complete.
Major changes:
@garrettjonesgoogle, please take a look when you have a moment and let me know if I'm on the right track