Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20F92DDD1 for ; Fri, 21 Sep 2012 08:59:03 +0000 (UTC) Received: (qmail 7235 invoked by uid 500); 21 Sep 2012 08:59:02 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 6689 invoked by uid 500); 21 Sep 2012 08:58:56 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 5416 invoked by uid 99); 21 Sep 2012 08:58:53 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2012 08:58:53 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C287138976; Fri, 21 Sep 2012 08:58:52 +0000 (UTC) From: bjnortier To: dev@couchdb.apache.org Subject: couchdb pull request: Document Id and Rev in response headers Content-Type: text/plain Message-Id: <20120921085852.C287138976@tyr.zones.apache.org> Date: Fri, 21 Sep 2012 08:58:52 +0000 (UTC) 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 Date: 2012-09-20T03:01:35-07:00 Document Id and Rev in response headers ----