Re: [streams] Operation stream (#287)

This is an extended version of WritableStream with the following functionality:
- single API to return a connected pair of writable side and readable side
- drained semantics on the readable side
- readable side can acknowledge read chunks
- writable side can receive acknowledgement info

See the example in the test file to see how this works for ReadFile/fread style source with buffer allocator residing in the source side.

write() returns a structure representing the status of the operation and read() returns an object to acknowledge the operation. These are for synchronous pumping, but can be removed if it's considered to be too complex.

async readInto() can be realized by using the writable side of the operation stream. You'll receive eof via write()'s return value. This serves for needs to allow users to bring their own buffer than allocating buffers inside a source. If write() being used for reading is confusing, we could rename write() of the operation stream to e.g. issue() and read() to accept(), take(), etc.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/287#issuecomment-75146200

Received on Thursday, 19 February 2015 21:53:37 UTC