Uh oh!
There was an error while loading. Please reload this page.
fs: add WriteStream.prototype.flush - #28519
Conversation
ea56413 to
030dc39CompareUh oh!
There was an error while loading. Please reload this page.
bnoordhuis
left a comment
There was a problem hiding this comment.
I appreciate that you took this on but this isn't quite what I had in mind. I tried to explain how it should work but don't hesitate to ask if anything is still unclear.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
54db609 to
14a8cf7Comparee4a7187 to
45c2b20Comparehimself65
commented
Jul 5, 2019
WIP |
himself65
commented
Jul 7, 2019
I'm trying to refactor the buffer poll to the task poll, which can solve if write chunk or do fsync |
addaleax
commented
Jul 7, 2019
@himself65 I’m not sure, but maybe #28520 can provide some inspiration? The code ultimately attempts to solve a very similar problem: Integrate flushing operations (and maybe this function here should also be called |
himself65
commented
Jul 8, 2019
so what is the case of example: ws.cork()ws.write('string')ws.flush()// or called ws.fsync()ws.write('string')ws.uncork()in the current will call |
addaleax
commented
Jul 8, 2019
@himself65 That’s indeed trickier… it might be okay to perform the |
b65f54e to
3df464dCompare0610606 to
173061fCompare| // There is no shutdown() for files. | ||
| WriteStream.prototype.destroySoon = WriteStream.prototype.end; | ||
| WriteStream.prototype._flush = function(cb) { |
There was a problem hiding this comment.
Fwiw, the naming is unfortunate here, but please be aware that the stream _flush() method does something very different than what the idea for fsync() calls is; it’s called just after the last chunk of data has been written, and doesn’t have anything to do with actually flushing data to the underlying resource (it’s not a great name, definitely).
8ae28ff to
2935f72Comparejasnell
commented
Jul 7, 2020
@himself65 ... still want to do this? Converting the PR to a draft given that it's still a work-in-progress |
fix#28513
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes