couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: view server line protocol changes for _list
Date Tue, 25 May 2010 23:42:31 GMT

On May 25, 2010, at 4:36 PM, Mikeal Rogers wrote:

> There is a fairly serious problem at the moment with using list
> functions in CouchDB.
> 
> To recap, the view server line protocol for _list functions looks like this.
> 
>>>> ["lists", "name", {request}]
> <<< ["start", ["chunks"], {"headers":{}, "code":200}]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["chunk", ["chunks"]]
>>>> ["list_end"]
> <<< ["end", ["tail chunks"]]
> 
> The problem with this is that the response from the view server that
> contains the status code MUST come before any list_row calls have
> happened. This means that the view server can't return 404 for queries
> that don't have any results. In fact, the view can really only return
> 200 for anything but a HEAD request on list functions.
> 
> I'd like to propose the following changes to the view server protocol
> for list functions.
> 
>>>> ["lists", "name"]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["start", "chunk", {"headers":{}, "code":200}]
> <<< ["send", "chunk"]
> <<< ["send", "chunk"]
> <<< ["getRow"]
>>>> ["list_row", {"key":"k","value":"v"}]
> <<< ["getRow"]
>>>> ["list_end"]
> <<< ["end", "tail chunk"]
> 
> The big change is that there is no longer a strict request/response.
> The erlang side stays idle accepting chunks to send until it gets a
> ["getRow"] call.
> 
> Also, all chunks sent in a single line to erlang get sent to the
> client in one chunk anyway so I changed the type from array to string
> since you can do multiple ["send"] calls between ["list_row"]
> responses anyway.
> 
> Thoughts?

I think this sounds right to me. I'm not seeing any big issues off the top of my head.

Chris

> 
> -Mikeal


Mime
View raw message