[Bug 23736] New: [Streams API] Add fork() method instead of having pipe(Stream[]) overload

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23736

            Bug ID: 23736
           Summary: [Streams API] Add fork() method instead of having
                    pipe(Stream[]) overload
           Product: WebAppsWG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Streams API
          Assignee: tyoshino@google.com
          Reporter: tyoshino@google.com
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, public-webapps@w3.org

There're requests to make it able to mirror a byte stream to multiple
destinations. Currently, it's addressed by pipe(Stream[]) but it involves
memory copy.

Rather than that, we could choose to make ReadableByteStream clonable.

fork() creates another ReadableByteStream instance that refers to the same
internal data source as the original ReadableByteStream. Implementation of the
original ReadableByteStream may choose to have range reference counting to
control lifetime of the original data source sequence.

Each ReadableByteStream works like "reading cursors" for the original data
source.

Since the internal data source sequence is not drained until all the cursors
are done, a slow consumer can block fast ones.

If you don't want to block the faster consumers, you can choose to insert a
ByteStream to buffer data for the slow consumer while keep draining data from
the original data source quickly.

----

We haven't done enough study about necessity of pipe().

pull/push strategy of pipe() should also be well researched.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 6 November 2013 06:57:34 UTC