couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject [25/43] couch-mrview commit: updated refs/heads/2971-count-distinct to f7c3c24
Date Wed, 01 Mar 2017 16:37:59 GMT
Add new function to get the view index pid.
Refactored the code to add a new function to return index pid for a
given view and design document.

COUCHDB-3150


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/fdaebcf0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/fdaebcf0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/fdaebcf0

Branch: refs/heads/2971-count-distinct
Commit: fdaebcf0fd26ed1d402ac6ec6448a8a2b7fbc808
Parents: a0b0392
Author: brkolla <bkolla@cloudant.com>
Authored: Wed Sep 21 14:52:57 2016 -0400
Committer: brkolla <bkolla@cloudant.com>
Committed: Fri Sep 23 11:29:56 2016 -0400

----------------------------------------------------------------------
 src/couch_mrview.erl      |  6 +++++-
 src/couch_mrview_util.erl | 16 ++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/fdaebcf0/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index 20eb4be..088327c 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -14,7 +14,7 @@
 
 -export([validate/2]).
 -export([query_all_docs/2, query_all_docs/4]).
--export([query_view/3, query_view/4, query_view/6]).
+-export([query_view/3, query_view/4, query_view/6, get_view_index_pid/4]).
 -export([view_changes_since/5]).
 -export([view_changes_since/6, view_changes_since/7]).
 -export([count_view_changes_since/4, count_view_changes_since/5]).
@@ -249,6 +249,10 @@ query_view(Db, DDoc, VName, Args0, Callback, Acc0) ->
     query_view(Db, VInfo, Args, Callback, Acc1).
 
 
+get_view_index_pid(Db, DDoc, ViewName, Args0) ->
+    couch_mrview_util:get_view_index_pid(Db, DDoc, ViewName, Args0).
+
+
 query_view(Db, {Type, View, Ref}, Args, Callback, Acc) ->
     try
         case Type of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/fdaebcf0/src/couch_mrview_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_util.erl b/src/couch_mrview_util.erl
index 934dcd3..fa81ac9 100644
--- a/src/couch_mrview_util.erl
+++ b/src/couch_mrview_util.erl
@@ -12,7 +12,7 @@
 
 -module(couch_mrview_util).
 
--export([get_view/4]).
+-export([get_view/4, get_view_index_pid/4]).
 -export([ddoc_to_mrst/2, init_state/4, reset_index/3]).
 -export([make_header/1]).
 -export([index_file/2, compaction_file/2, open_file/1]).
@@ -40,11 +40,7 @@
 
 
 get_view(Db, DDoc, ViewName, Args0) ->
-    ArgCheck = fun(InitState) ->
-        Args1 = set_view_type(Args0, ViewName, InitState#mrst.views),
-        {ok, validate_args(Args1)}
-    end,
-    {ok, Pid, Args2} = couch_index_server:get_index(?MOD, Db, DDoc, ArgCheck),
+    {ok, Pid, Args2} = get_view_index_pid(Db, DDoc, ViewName, Args0),
     DbUpdateSeq = couch_util:with_db(Db, fun(WDb) ->
         couch_db:get_update_seq(WDb)
     end),
@@ -67,6 +63,14 @@ get_view(Db, DDoc, ViewName, Args0) ->
     {ok, {Type, View, Ref}, Sig, Args3}.
 
 
+get_view_index_pid(Db, DDoc, ViewName, Args0) ->
+    ArgCheck = fun(InitState) ->
+        Args1 = set_view_type(Args0, ViewName, InitState#mrst.views),
+        {ok, validate_args(Args1)}
+    end,
+    couch_index_server:get_index(?MOD, Db, DDoc, ArgCheck).
+
+
 ddoc_to_mrst(DbName, #doc{id=Id, body={Fields}}) ->
     MakeDict = fun({Name, {MRFuns}}, DictBySrcAcc) ->
         case couch_util:get_value(<<"map">>, MRFuns) of


Mime
View raw message