Repository navigation
core,netty: split stream state on client-side; AbstractStream2 - #2140
Conversation
| * Requests up to the given number of messages from the call to be delivered. This should end up | ||
| * triggering {@link TransportState#requestMessagesFromDeframer(int)} on the transport thread. | ||
| */ | ||
| void request(int numMessages); |
There was a problem hiding this comment.
nit: seems a bit strange to call request on something called a Sink
There was a problem hiding this comment.
The other class is called TransportState. Perhaps a better name for this interface would be ApplicationState?
There was a problem hiding this comment.
Implementations of this interface don't generally hold interesting state. The application state is held by Abstract{Client,}Stream2.
The reason for this interface is to simplify the naming issues we were having and make it more obvious what calls what.
There was a problem hiding this comment.
So then doesn't the same comment apply to TransportState? Perhaps both should be renamed to be more consistent?
There was a problem hiding this comment.
I don't really follow. Rename Abstract{Client,}Stream2 to ApplicationState? Rename TransportState to... ???Sink? Rename both? There's three classes/interfaces involved and I don't understand what pair would gain what advantage.
I don't see the lack of consistency here, because no class is a true inverse of another. I can agree that TransportState is a bit of a weak name, but it gets the point across pretty well and I'm not aware of a better name.
At some point we could introduce Sinks to TransportState. I didn't because it seemed to add complexity without actually simplifying anything, because the various methods are pretty intertwined (especially w.r.t. error handling, since the transport has to be notified).
There was a problem hiding this comment.
No, I'm not suggesting that you rename the stream, itself. I'm suggesting that Sink/TransportState are two views of the stream, each performs ~half the work of the stream, and that they should have consistent names to make this more obvious. Names like ApplicationView and TransportView would make this clear in my mind.
There was a problem hiding this comment.
I'm suggesting that Sink/TransportState are two views of the stream
But... it's not. Sink holds no state. Sink is only to make it obvious how the abstract class interacts with the subclass, and that those method have no need to interact with the rest of the stream state.
Names like ApplicationView and TransportView would make this clear in my mind.
I can't see any way I would use "View". View would seem to imply that the state is shared. That's exactly the opposite of what I want to portray.
If I called something ApplicationState it would be AbstractClientStream2. But that seems a much poorer name than its current name (even assuming that it was tweaked as necessary to ClientStreamApplicationState).
|
LGTM. I like your tests :). |
|
Would anyone like more time to review? I expect there is still the variable name discussion that Nathan brought up. Is there anything else outstanding?
... what about them? |
don't be scared :). I think there is an elegance to |
|
I will |
|
Derp, that button is too close. |
| super(maxMessageSize); | ||
| } | ||
|
|
||
| protected abstract void http2ProcessingFailed(Status status, Metadata trailers); |
There was a problem hiding this comment.
Could you add a javadoc to abstract methods?
OkHttp will need to be migrated in a future commit.
This is a continuation of what already was done for server-side (#1656). Although
AbstractClientStream2 looks like new code, it is a reorganization of existing code
(although heavily reworked).