[whatwg/streams] Provide a way for the underlying sink to signal write progress? (#876)

@lgrahl brought up in an offline conversation that the way that a writer's desiredSize jumps in response to the underlying sink's write() promise fulfilling can be problematic for large chunk sizes. He thought it would be nicer if there were a way to signal write progress along the way, thus allowing the producer to get a notification that they can write more bytes sooner, rather than later.

Concretely, you can imagine something like

```js
write(chunk, controller) {
  return fileSystem.write(fd, chunk, progressCallback);
  
  function progressCallback(bytesSoFar) {
    controller.writeProgress(bytesSoFar);
  }
}
```

This seems a little fragile and tricky; e.g. how does it interact with the size of the chunk as computed by the queuing strategy; having to deal with this new controller method being called at inappropriate times; giving it a good name; etc. But you at least get the idea.

I think the next step hear is learning more about systems where this would make sense. The underlying sinks I'm most familiar with don't have this progress-reporting capability. Hopefully @lgrahl can weigh in.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/876

Received on Wednesday, 31 January 2018 22:06:31 UTC