couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: sending head of a view result in one chunk
Date Thu, 30 Jul 2009 18:56:55 GMT
On Wed, Jul 29, 2009 at 08:30:33PM +0200, Benoit Chesneau wrote:
> Following discussion on irc  I post here my problem. I am currently
> implementing a feature allowing me to parse the view while it's coming
> over http.  Using chunks allow me to parse each line easily. It
> currently work but currently first line of view is sent with the
> header. It would be better imo to send the header and the first line
> in different chunks, so It isn't needed to split the result. What do
> you think about it ?

Are you talking about HTTP chunking? I think it's an extremely bad idea to
rely on HTTP chunk boundaries to have significance in the sub-parts of the
body. Maybe CouchDB could generate chunks like that, but it could all be
lost by any intermediate proxy.

For parsing views in a streaming manner, CouchDB inserts a newline after
each row. This is a frig, but at least it's a portable frig. CouchRest
handles this quite happily. The headers and body are separated by \r\n\r\n
of course, and there's not much you can do about that.

Or do you mean sending a newline after the opening part of the JSON doc?
This is already done, as far as I can see.

$ curl http://127.0.0.1:5984/testdb/_all_docs
{"total_rows":1,"offset":0,"rows":[
{"id":"12345","key":"12345","value":{"rev":"1-171352454"}}
]}

I may have misunderstood you completely though.

Regards,

Brian.

Mime
View raw message