Transform backpressure approach 2 request for comments #110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See individual commit messages for details. /cc @othiym23 @tyoshino
The first two commits seem like a good idea to me, independent of their surroundings. Especially the writable one. The readable one is a bit sketchier, since without the next two commits, there's no way for consumers to know that they should be picking up data ASAP.
The next two commits are using the reference implementation + tests to prototype approach 2 from #24 (comment). Take a look at the tests especially, since those highlight what I'm hoping to accomplish.
The additional internal complexity introduced is sad. But it has some benefits, I think:
read()
from a stream that is being piped elsewhere. The API is explicitly designed around single-consumer, with problems occurring if you try to violate that. This revision makes that explicit, by erroring if you try toread()
from a piped stream.That said, I still want to explore the solution space here heavily. I'll probably do a branch with approach 5 as well, and I had an idea for approach 4 that I will reiterate back over in that thread.