[streams] Readable byte streams should support an internal queue (#353)

The current draft does not include such a queue; there is a one-to-one map of calls to `rbsReader.read()` and `rbsUnderlyingSource.pull()`. I think this is potentially problematic, for two reasons:

- Kernel buffers can become full, if I understand correctly. Thus, the code for `rbsUnderlyingSource.pull()` will not be a simple call to `read(2)` or similar. Instead, the underlying source author will need to do their own buffering. That seems bad.
- We want readable byte streams to be resistant to uneven flow: e.g., if the consumer slows down for a bit, then gets much faster, then slows down for a bit, it would be better to have some chunks read ahead of time to so that we can match their pace (up to a high water mark).

This does make things more complicated though for the BYOB case, as we have to figure out what happens if the internal queue has things in it and then we switch to a BYOB reader. This was discussed at https://github.com/whatwg/streams/issues/177#issuecomment-83984473

@tyoshino, have your thoughts changed since that discussion? Or is the current draft lacking a queue just as a first-draft thing?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/353

Received on Sunday, 3 May 2015 18:54:10 UTC