Thanks for the feedback. 
Just a note, this isn't dealing with pubsub in Redis but rather how it 
replies to multi-bulk commands...commands which will receive more than one 
item.
The problem with dropping this empty reply is the necessity now to bind a 
'end' event and check if data- a reply - was returned. 



On Wednesday, September 5, 2012 11:59:14 AM UTC-5, Dominic wrote:
>
> it's much easier to write high level apis with js objects in streams, 
> and then pipe to a stream that can stringify it. This reduces glue code, 
> and  increases flexibility, because you can use a high level stream with 
> any kind of text-stream. 
>
> Otherwise every stream module needs a parser... 
> or you get more monolithic tools that wrap tcp servers or socket.io. 
>
> In this case, prehaps the best thing is to emit a data event with an 
> empty array in it. 
>
> the pub-sub feature of redis is a bit weird, kinda tacked on to redis, 
> but probably better to let it's own documented behaviour 'fall through' 
> rather than try to 'fix' it. 
>
> On Tue, Sep 4, 2012 at 5:15 PM, Mikeal Rogers 
> <[email protected]<javascript:>> 
> wrote: 
> > I tend to agree. 
> > 
> > The current implementation in most of node allows setEncoding to change 
> the 
> > data event to emit buffers. In the case of several userland streams 
> strings 
> > are emitted. 
> > 
> > For efficiency, if people are expected to work with the data as a string 
> it 
> > is much cheaper to avoid unnecessary conversions, but IMO it's painful 
> to 
> > not be able to assume "data" events will be Buffers. 
> > 
> > -Mikeal 
> > 
> > On Sep 3, 2012, at September 3, 20128:26 PM, tjholowaychuk 
> > <[email protected] <javascript:>> wrote: 
> > 
> > IMO if the idea behind streams are to act like pipes then "data" events 
> > should only be "raw" data aka Buffers (strings too I guess), 
> > if it's a non-stream then whatever I guess 
> > 
> > On Monday, 3 September 2012 15:44:55 UTC-7, Mike Nichols wrote: 
> >> 
> >> When issuing a redis command which expects a multi-bulk reply but the 
> key 
> >> does not exist, one may receive the following: 
> >> +OK 
> >> *0 
> >> 
> >> The redis docs say "If the specified key does not exist, the key is 
> >> considered to hold an empty list and the value 0 is sent as multi bulk 
> >> count." 
> >> 
> >> It seems like it is proper to emit a 'data' event in a client library 
> with 
> >> the 'empty list' redis implies so that consuming code can use it in a 
> >> pipeline and let the consumer handle the `empty list` there. 
> >> 
> >> This came from looking at 'https://github.com/tblobaum/redis-stream' 
> where 
> >> this sort of reply drops the data, thus breaking the pipeline. 
> >> 
> >> This leads me to the greater question on whether or not to emit 'data' 
> for 
> >> a empty value. My gut says low level libs like these _should_ emit the 
> event 
> >> with empty data but I wonder what other authors are preferring. 
> >> 
> >> Any opinions would be appreciated on this. 
> >> 
> > 
> > -- 
> > 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 
> > 
> > 
> > -- 
> > 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 
>

-- 
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

Reply via email to