Skip to content
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

docs: fix description of _writev() #28690

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1754,8 +1754,9 @@ methods only.

The `writable._writev()` method may be implemented in addition to
`writable._write()` in stream implementations that are capable of processing
multiple chunks of data at once. If implemented, the method will be called with
all chunks of data currently buffered in the write queue.
multiple chunks of data at once. If implemented, the first chunk will be written with
`_write()`. When the initial write is complete, buffered chunks in the write queue, if available,
Copy link
Member

@Trott Trott Jul 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure our linter will complain that this line is longer than 80 chars and has trailing white space. At least I hope it will flag those things. Run make lint-md (or vcbuild lint-md if on Windows) to run the documentation linter locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: Welcome @tyof45 and thanks for the pull request!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s not just the first chunk, but rather, _write() is always used when there is only one chunk in the queue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the queue is empty.

Copy link

@erabhimanyu erabhimanyu Aug 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't current docs correct in that case @addaleax @lpinca ? Though still bit ambiguous. Does below seems more correct -

if implemented, only the writable._writev() method will be called with all chunks of data currently buffered in the write queue. In case there is only a single data chunk to be processed writable._write() is called instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erabhimanyu I think your suggestion is still confusing. In particular this sentence

In case there is only a single data chunk to be processed writable._write() is called instead

If there is buffered data even a single chunk, writable._writev() will be used.

will be written all at once with `_writev()`.

The `writable._writev()` method is prefixed with an underscore because it is
internal to the class that defines it, and should never be called directly by
Expand Down