couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject fabric commit: updated refs/heads/2655-r-met to 90e9691
Date Thu, 02 Apr 2015 10:48:06 GMT
Repository: couchdb-fabric
Updated Branches:
  refs/heads/2655-r-met [created] 90e969194


Optionally indicate if "r" was met

COUCHDB-2655


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/90e96919
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/90e96919
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/90e96919

Branch: refs/heads/2655-r-met
Commit: 90e96919475bc1108280581d587bfdaf19f5ea06
Parents: 985f136
Author: Robert Newson <rnewson@apache.org>
Authored: Thu Apr 2 11:47:23 2015 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Thu Apr 2 11:47:44 2015 +0100

----------------------------------------------------------------------
 src/fabric_doc_open.erl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/90e96919/src/fabric_doc_open.erl
----------------------------------------------------------------------
diff --git a/src/fabric_doc_open.erl b/src/fabric_doc_open.erl
index c7d90a4..e1f3d57 100644
--- a/src/fabric_doc_open.erl
+++ b/src/fabric_doc_open.erl
@@ -46,7 +46,7 @@ go(DbName, Id, Options) ->
     try fabric_util:recv(Workers, #shard.ref, fun handle_message/3, Acc0) of
     {ok, #acc{}=Acc} ->
         Reply = handle_response(Acc),
-        format_reply(Reply, SuppressDeletedDoc);
+        format_reply(Reply, SuppressDeletedDoc, Acc#acc.state, Options);
     {timeout, #acc{workers=DefunctWorkers}} ->
         fabric_util:log_timeout(DefunctWorkers, "open_doc"),
         {error, timeout};
@@ -156,9 +156,16 @@ choose_reply(Docs) ->
     end, Docs),
     {ok, Winner}.
 
-format_reply({ok, #doc{deleted=true}}, true) ->
+
+format_reply({ok, #doc{deleted=true}}, true, _, _) ->
     {not_found, deleted};
-format_reply(Else, _) ->
+format_reply({ok, Doc}, _, RMet, Options) ->
+    Meta = case lists:member(is_r_met, Options) of
+        true -> [{r_met, RMet == r_met} | Doc#doc.meta];
+        false -> Doc#doc.meta
+    end,
+    {ok, Doc#doc{meta=Meta}};
+format_reply(Else, _, _, _) ->
     Else.
 
 


Mime
View raw message