-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add ReadableByteStream definition #343
Conversation
WIP |
https://streams.spec.whatwg.org/branch-snapshots/readablebytestreamspec/ for preview. Has some minor errors. I will push an extra commit to fix those (but won't force-push in case you have work locally). |
In terms of the MVP for helping MSE, I think we want:
I think it'd also be ideal to not have any known-inaccurate algorithms, and for the ones we're unsure on have a warning |
- Mention readable byte stream reader in Locking section - Don't mention Writable Byte Stream for now - Add a short introduction text about readable byte stream - Fit 120 col - Don't mention BYOB reader for now - Refer to readable stream about pipeTo - Rename fulfill() to resolve() - Rename FinishClosingReadableByteStream to CloseReadableByteStream - Add TeeReadableByteStream algorithm - Add new ReadableByteStream algorithm
Thanks for the advice. I've pushed one more commit. Yes, I found that dfn was missing for underlying byte stream but couldn't push the fixed one yesterday. I tried to define ReadableByteStream without the default built-in queue. If it turns out to be not promising, I'll just revert them to just refer to ReadableStream's algorithms. BTW, when I run ecmarkupify, npm complains like "... node_modules/ecmarkupify/package.json not found". Do you have any ideas what's happening? |
The only thing I can think of is make sure you are on a recent io.js and then do |
Thanks! I didn't know I needed io.js. It works now. |
Don't mention writable side for now.
…er pull Also fixes typo (ErrorReadableStream to ErrorReadableByteStream)
- Remove unnecessary guard [[closedOrErrored]] - Fix texts - Call read() on the original stream only if the number of read() calls hasn't reached sufficient number by the other branch's invocation
Ready for review. This PR should also satisfy #312. |
Will try to do review tonight or tomorrow morning. What are your thoughts on a reference implementation/tests? |
|
||
<h3 id="rbs-intro">Using Readable Byte Streams</h3> | ||
|
||
<div class="example"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These informative sections don't seem quite complete. But, I can try my hand at expanding them.
OK, I guess I couldn't resist at least a high-level review. I am a bit confused by the controller + underlying source model here. From what I can see, the idea is that pull() is called on each read, and each time it is called, you can call c.resolve(chunk) once. Is that the idea? I thought though that ReadableByteStream was going to need an internal queue as well. Because what if someone doesn't read for a long time, and the kernel buffer starts getting full? Do we make underlying byte source implementers do their own buffering to handle that case? Also I know we had a discussion in person which concluded that The |
1. Set _reader_@[[ownerReadableByteStream]] to *undefined*. | ||
</pre> | ||
|
||
<h4 id="tee-readable-byte-stream" aoid="TeeReadableByteStream">TeeReadableByteStream ( stream, shouldClone )</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is complicated. With the queues and such. Could you summarize for me how it works? It looks similar to TeeReadableStream but I am betting there are important differences.
Right. The readable byte stream is kept as minimum as possible but able to represent invariants, constraints, semantics of the API surface completely. The controller is not designed considering usability. Maybe, I should not have added the controller API but only define abstract operations to manipulate the readable byte stream's state.
The latter.
You were imagining some example implementation of the underlying source where you're trying to encapsulate an async API that returns a promise. And you said that we basically want to return the promise (as-is or after some transform) than converting it to call to
Was using fulfill. Fulfill might be better as the streams are supposed to be enqueued non-promise values? |
I see. So we may want to make it clear that this is still undergoing revision. But the public API will be OK.
This seems sad. Also I think we wanted to support buffering (in the non-BYOB case) to avoid "jitter"? Hmm.
Right, I remember the argument for using promises instead of
I meant more pick a verb that has nothing to do with promises. Looking through a thesaurus, here are some random options: answer, conclude, fill, finish, satisfy, produce, complete, finalize, respond. Anyway, let's start merging stuff and iterating on it in further PRs and issues, using #300 as the central tracking issue once the dust settles. I think we should squash everything into a single commit that does the following:
If this sounds good to you, let me know. If you are ready to go to sleep then I will do it (and file a few follow-up issues/PRs). Or if you want to take care of some other stuff first before we merge, or you want to work on the squashed commit yourself, then that's good too :). |
IIRC, it was something like race between:
We were drawing timeline on a whiteboard to discuss this. |
Yeah. I just wish we had captured it somewhere digital, haha. |
Thanks. I'm adding BYOB stuff in local copy but that doesn't block the work. I'm still in the office but wouldn't get time to do squashing, etc. before last train. So, please :) |
Merged as 5b47faa per plan at #343 (comment). |
No description provided.