Uh oh!
There was an error while loading. Please reload this page.
stream: implement WritableBase without buffering - #33515
Conversation
This is very much WIP but I would like some initial feedback whether this is worth further engagement. |
ronag
commented
May 22, 2020
@nodejs/streams |
There was a problem hiding this comment.
extends WritableBase.WritableState
ronag
commented
May 22, 2020
Might also be useful for the QUIC work. |
mcollina
commented
May 25, 2020
I really like the direction this is going, however I would prefer to land this together with the changes in the other places it is targeting. I suspect you want to try making |
ronag
commented
May 25, 2020
Good. I just wanted to make sure this is worth spending more time on. I'll start with |
Uh oh!
There was an error while loading. Please reload this page.
mcollina
commented
May 25, 2020
(Keep them on separate commits, so that we can easily split it up if we need to for ease of backporting). |
8ae28ff to
2935f72Comparec83723e to
a3fdb90Comparenodejs-github-bot
commented
Jun 21, 2020
@mcollina: This kind of works now... Still has some details I would like to improve upon. However, when trying to use it to implement
Maybe @jasnell would have use of this for quic... not sure where to take it from here. Maybe put on ice for now? |
mcollina
commented
Jun 21, 2020
Given all the above, I would put on ice. Unless @jasnell (or somebody else) has a good use for this. |
This separates the
Writableclass into two classes aWritableBaseclass which implements allWritablelogic except for anything related to buffering, and aWritableclass which inheritsWritableBaseand adds the buffering logic.This is in order to be able to consistently and in a performant way implement
Writablestreams that want to implement their own buffering or are simply wrapping existing streams.WritableBaseexpects 2 methods passed throughoptions:write: which is basically thewriteOrBufferimplementation from today.flush: which is basicallyend()+ wait for completion from today.Note, that this is for now only for internal core usage not meant for public API.
This will help with making
Writablelike implementations where we want to avoid buffering or sequential writes more streams compliant, e.g.OutgoingMessage.It will also help with some optimization e.g. avoid buffering both input and output of
Transformstream by implementing it in terms ofReadable+WritableBaseinstead ofReadable+Writable.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes