couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [2/9] couch-mrview commit: updated refs/heads/master to 065dc26
Date Fri, 30 Jan 2015 18:10:55 GMT
Pass namespace parameter in extra field of #mrargs{}

COUCHDB-1145


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/2212d287
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/2212d287
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/2212d287

Branch: refs/heads/master
Commit: 2212d2877867b144922062d084fda6fd6c53182d
Parents: 119fced
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Tue Dec 16 12:38:13 2014 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Wed Dec 31 10:46:58 2014 -0800

----------------------------------------------------------------------
 src/couch_mrview_http.erl | 8 ++++++--
 src/couch_mrview_util.erl | 5 ++---
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2212d287/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 28d1cc5..527c89e 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -191,12 +191,13 @@ all_docs_req(Req, Db, Keys, NS) ->
         do_all_docs_req(Req, Db, Keys, NS)
     end.
 
-do_all_docs_req(Req, Db, Keys, _NS) ->
+do_all_docs_req(Req, Db, Keys, NS) ->
     Args0 = parse_params(Req, Keys),
+    Args1 = set_namespace(NS, Args0),
     ETagFun = fun(Sig, Acc0) ->
         check_view_etag(Sig, Acc0, Req)
     end,
-    Args = Args0#mrargs{preflight_fun=ETagFun},
+    Args = Args1#mrargs{preflight_fun=ETagFun},
     {ok, Resp} = couch_httpd:etag_maybe(Req, fun() ->
         VAcc0 = #vacc{db=Db, req=Req},
         DbName = ?b2l(Db#db.name),
@@ -212,6 +213,9 @@ do_all_docs_req(Req, Db, Keys, _NS) ->
         _ -> {ok, Resp}
     end.
 
+set_namespace(NS, #mrargs{extra = Extra} = Args) ->
+    Args#mrargs{extra = [{namespace, NS} | Extra]}.
+
 is_admin(Db) ->
     case catch couch_db:check_is_admin(Db) of
     {unauthorized, _} ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2212d287/src/couch_mrview_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_util.erl b/src/couch_mrview_util.erl
index 2378fc8..f41aed6 100644
--- a/src/couch_mrview_util.erl
+++ b/src/couch_mrview_util.erl
@@ -694,9 +694,8 @@ reset_state(State) ->
     }.
 
 
-all_docs_key_opts(Args) ->
-    all_docs_key_opts(Args, []).
-
+all_docs_key_opts(#mrargs{extra = Extra} = Args) ->
+    all_docs_key_opts(Args, Extra).
 
 all_docs_key_opts(#mrargs{keys=undefined}=Args, Extra) ->
     all_docs_key_opts(Args#mrargs{keys=[]}, Extra);


Mime
View raw message