Re: [streams] Port precise flow control to writable streams (#318)

> How should the ready signal work?

`waitForDesiredSize(n)` is useful when the producer know that the stream will have a space >= n. Given a stream but without high water mark value, a producer cannot determine what n would work (don't wait forever) for the stream. I think we need to make n optional and then `waitForDesiredSize(undefined)` work as `waitForDesiredSizeChange/Increase()`. I.e. equiv of (3), (4). I think it would work like the following:
- when `.waitForDesiredSize(undefined)` is called, the writer remembers current space available for write
- when it changes/increases compared to the saved value, resolve the promise.
- and then, the producer checks `desiredSize` and produce appropriate size of data and write it.
- seems "change" should be "change to different value than the saved && the new value is positive", and "increase" should be "increase to a value more than the saved && positive". But not sure. A producer may want to target some value more than the stream expects for some reason. I.e. it may want to get notified even when the desiredSize is not yet positive.


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

Received on Monday, 24 August 2015 09:35:54 UTC