incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bjnortier <...@git.apache.org>
Subject couchdb pull request: Document Id and Rev in response headers
Date Fri, 21 Sep 2012 08:58:52 GMT
GitHub user bjnortier opened a pull request:

    https://github.com/apache/couchdb/pull/32

    Document Id and Rev in response headers

    This patch adds the X-Couch-Id and X-Couch-Rev headers to responses, so that a custom
default_handler can act on DB changes (e.g. create tasks).
    
    We have a custom default_handler that creates Celery tasks via a Python process. It wraps
the couch_httpd_d:handle_request/1 function, looks at the response, then creates some tasks.
What it needs is the document Id and Rev for each PUT/POST/DELETE request, but those are not
available from the Response on that level (the response body is sent to the socket inside
the black box somewhere). The headers are available. So we decided to add the Id and Rev to
the JSON responses and also the update function as X-Couch-Id and X-Couch-Rev. When using
an update function, the rev is available though "X-Couch-Update-NewRev", so only the Id has
been added.
    
    We have a large amount of small databases (potentially thousands), so it is not practical
to listen to changes on every DB.  
    
    If there is another recommendation to achieve this without patching, please suggest an
alternative.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bjnortier/couchdb id_and_rev_in_response_headers

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb/pull/32.patch

----
commit fe934a16760dcbf975d9f8b4923eee53747bfd25
Author: Benjamin Nortier <bjnortier@gmail.com>
Date:   2012-09-20T03:01:35-07:00

    Document Id and Rev in response headers

----


Mime
View raw message