Thanks Isaac. I understand what you are saying. However if you bear with me, the counterargument I had in mind is the following:
Sequential write execution is very common (all file operations I guess), but not the only method for "writing" streaming data. There are plenty of cases where "write" operations of incoming streams can be (and should be) done in parallel (i.e. inserting into a database). A default highWaterMark =1 across the board for writable streams would ensure sequential execution, unless the user specifically asks for more. So in this case highWaterMark > 1 would mean asynchronous writes (with a warning label). The write requests would still be called in sequential order, however a mandatory block is only in place if outstanding requests >= highWaterMark. Currently the highWaterMark of the writable stream seems to be a bit like an orphan-buffer in terms of operation control. In any case I guess piping into a simple queue ( https://gist.github.com/ZJONSSON/5189249) of some sorts is the answer here, but I nevertheless wanted to float this idea. On Thursday, April 4, 2013 1:56:45 PM UTC-4, Isaac Schlueter wrote: > > The current design is intended. > > The purpose of streams is to enable asynchronous sequential data > flows. In any "real" stream, you do not ever want multiple write > operations to be happening at once. Consider what would happen if you > did this when writing to a file, or socket, or crypto hashing stream, > or compressor. Your data would be corrupted. > > Stream is to Time as Array is to Space. It doesn't make much sense to > have multiple write() operations happening in parallel. For use cases > where it *does* make sense, what you have is not a Stream, but some > other type of abstraction, and it should probably not be shoehorned > into the Stream shape, imo. > > > > > On Thu, Apr 4, 2013 at 10:24 AM, Sigurgeir Jonsson > <[email protected] <javascript:>> wrote: > > Would it make sense to amend stream.Writable so that highWaterMark > stands > > for the maximum number of write-operations (callbacks) outstanding at > each > > point? > > Currently, it seems that stream.Writable is stuck in sequential mode, > i.e. > > only one write operation can be outstanding at any given point, until > > callback. > > > > -- > > -- > > Job Board: http://jobs.nodejs.org/ > > Posting guidelines: > > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > > You received this message because you are subscribed to the Google > > Groups "nodejs" group. > > To post to this group, send email to [email protected]<javascript:> > > To unsubscribe from this group, send email to > > [email protected] <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/nodejs?hl=en?hl=en > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "nodejs" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
