-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consider allowing a stream to be removed from a pipeline #307
Comments
Can you elaborate the use case? Initially we need What's going on in piping is basically not observable from the streams API. Which of the objects tells the timing to collapse |
The example I was provided was a processor which decrypts cookies in a network stream. Once the cookies have passed they want only the native C++ stream processors operating for the rest of the http response body. Bouncing through js for a function that will never do anything forces a de-opt. |
If the cookie decrypter is designed to become This is handled as non-purposeful closure (https://github.com/whatwg/streams/blob/master/reference-implementation/lib/readable-stream.js#L79), so, we might need to change this line, ... or, making the decrypter Another approach: The decrypter starts exerting backpressure not to receive data from the network stream anymore. |
@trevnorris, does the above address your use case? |
Talking with @trevnorris, it sounds like it would be useful to allow a stream to be removed from a pipeline as an optimization.
For example, if
a.pipeThrough(b).pipeTo(c)
, removeb
at some point soa
goes straight toc
.This optimization is particularly useful if
a
andc
are native C++ implementations and removingb
means its not necessary to execute javascript any more.Potential APIs for this would be
b.collapse()
or perhapsb
could return a special value from its write or read methods signalling it should be removed from the pipe chain.The text was updated successfully, but these errors were encountered: