- From: Domenic Denicola <notifications@github.com>
- Date: Wed, 02 Sep 2015 17:56:09 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/318/137286786@github.com>
> (1) and (2) would work but changed signal is more flexible (yeah, HWM=0 would behave as them). What's the reason you preferred them than changed signal? Simplicity? I understand that the name "ready" isn't good name for "changed" signal, though. Yeah, basically simplicity. I cannot figure out the use case for the generic changed signal. The generic changed signal seems to not be very aligned with the high water mark idea. That is, I think two valid default strategies are either you should always be writing when desiredSize > 0 (1), or you should wait until the stream is drained and desiredSize = HWM (2). Anything more customizable can be taken care of by specific calls to waitForDesiredSize(n), with a parameter. (Remember, we are just trying to decide the default for `waitForDesiredSize()`, or whatever it is called.) In fact, maybe it does not matter too much. I think you can get (4) with `writer.waitForDesiredSize(writer.desiredSize + 1)`. (Well, assuming your sizes are integers. If we really wanted to fix that we could do `.waitForDesiredSize(n, { comparison: ">" })` or similar.) I also noticed when reviewing Node streams that their `'drain'` event is (2), not (1). Given this I propose: `writer.waitForDesiredSize(n = high water mark)`, i.e. default to (2). This will fulfill when desiredSize becomes >= min(highWaterMark, n). > Yeah. When HWM of 0 is used, desiredSize would be 0 or negative. The problem is that pipeTo() should be designed to (possibly by having some mode to) be able to push data to such a writable stream. > > "Push only when non-negative" would work? > > ... Maybe this works? I think this works if we say waitForDesiredSize waits for >= min(highWaterMark, n). So in this case it will be equivalent to waitForDesiredSize(0), which fulfills as soon as the queue drains. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/318#issuecomment-137286786
Received on Thursday, 3 September 2015 00:56:38 UTC