Conversation
3ce4d2c to
37f1ab0
Compare
|
@Fishrock123 I just started looking a bit into Bob streams and I'm curious about your take on this. |
10bf659 to
879c459
Compare
|
Can we use a different event name? I recognize |
Sure, though I'm not sure what that could be, https://www.thesaurus.com/browse/ready?s=t.
|
|
rebased |
879c459 to
f25db5e
Compare
f25db5e to
a39af0c
Compare
|
@mcollina is it an option to use Symbols as event "names" to avoid collisions? e.g. const r = new Readable();
r
.on(Readable.READY, () => {})
.on(Readable.DATA, (buf) => {})
.on(Readable.ERROR, (err) => {});Probably a too big of a change... just a possibly interesting idea... |
4188668 to
2a16612
Compare
|
I'm not sure what would be a better name that reduces the risk of clashing with userland. Perhaps an added prefix of some kind might help with that, like |
|
I’ve tagged semver-major out of cautiousness because it’s a significant refactor. |
|
I agree with @mscdex concern, we need to find a different name. |
|
This needs a rebase. |
2a16612 to
250b78b
Compare
|
@nodejs/streams @nodejs/tsc This PR have been stale for a while. Maybe another round of reviews might be appropriate to ensure we are all comfortable with the changes? I have one thing I wanted to point out. Given the current implementation Also, for those returning to this PR. The biggest change since the last round of reviews is that |
|
Why the addition of the empty file, 'does not exist' ? |
Mistake. Removed. |
This duplex creation regression seems to be re-occuring. Anyway, I think this is an unfortunate but acceptable regression given what this PR does. |
Provide a standardized way of asynchronously creating and initializing resources before performing any work. Refs: nodejs#29314
|
The async construction feature is def nice and tricky to impl atm. |
We do add an event but it's a |
|
@mcollina I'm getting a suspicious CITGM failures on pino. Any insight? https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/2386/nodes=rhel7-s390x/testReport/(root)/citgm/pino_v6_3_0/ Is this a pino issue or issue with this PR? |
|
Pino is ok with the change. A test fail because of another deprecation. |
|
Landed in 9949a2e...54b36e4 |
|
arm-fanned has been offline for a while now and it's back on and should be working again but this PR is causing a perma-fail that wasn't caught because it was merged while they were offline. Sorry @ronag, would you mind taking a look? I haven't had a look at what this test does but a brief scan suggests that a timeout is probably odd so maybe the slower platforms are catching a genuine bug? If not, either use the |
There is no timeout. It's probably the test not completing for whatever reason. |
|
@rvagg Do you have a machine I can access for reproducing? |
|
@ronag you can request access to a machine in https://github.com/nodejs/build/issues/new |
Provide a standardized way of asynchronously creating and initializing resources before performing any work.
Some streams need to first asynchronously create resources before they can perform any work. Currently this is implemented in the different stream implementations which both makes things partly duplicated, more difficult, more error prone and often incorrect to some degree (e.g.
'open'and'ready'are emitted after'close').This PR provides a standardized way of asynchronously constructing streams and handles the "pending" state that occurs until construction has either completed or failed.
This will allow further simplification and improved consistency for various stream implementations such as
fsandnetstream.Passes the graceful-fs test suite.
This will make it possible to easily implement more complex stream such as e.g. fs streams:
Furthermore it makes it easier to e.g. add transforms into pipeline by inlining initialization:
Semver
I think this should be semver-major.
fs: Emit some previously synchronous errors asynchronously. See updated test. Bug fix.fs:open()is removed but it still works if monkey-patched.fs: Don't emit'close'twice ifemitClose: true.fs:stream.fdis nulled duringdestroyinstead offinal. See updated test.Otherwise, this should be pretty non breaking as far as I can tell.
graceful-fstests pass and there are tests for compat.The changes are mostly opt-in through the
constructmethod, except for the previously listed updates tofsstreams.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesRefs: #29314, #23133
NOTE TO SELF: After merge look into:
emitCloseand make'close'behaviour align with streams.close(cb)in favour ofend(cb). Makeclose(cb)callend(cb).