couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [3/4] fabric commit: updated refs/heads/1843-feature-bigcouch-clustered-eventsource-changes-feed to 4f9cc9e
Date Wed, 28 May 2014 22:46:45 GMT
Pass Options to all_docs and open_doc


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

Branch: refs/heads/1843-feature-bigcouch-clustered-eventsource-changes-feed
Commit: 909585902bc239b11c87471d39ca326b4cab1e47
Parents: 641b815
Author: Robert Newson <rnewson@apache.org>
Authored: Tue May 27 12:04:58 2014 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue May 27 17:03:38 2014 +0100

----------------------------------------------------------------------
 src/fabric.erl               | 14 +++++++-------
 src/fabric_rpc.erl           |  6 +++---
 src/fabric_view_all_docs.erl | 16 ++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/90958590/src/fabric.erl
----------------------------------------------------------------------
diff --git a/src/fabric.erl b/src/fabric.erl
index 5be6f49..3febcc4 100644
--- a/src/fabric.erl
+++ b/src/fabric.erl
@@ -29,7 +29,7 @@
     update_doc/3, update_docs/3, purge_docs/2, att_receiver/2]).
 
 % Views
--export([all_docs/4, changes/4, query_view/3, query_view/4, query_view/6,
+-export([all_docs/5, changes/4, query_view/3, query_view/4, query_view/6,
     get_view_group_info/2]).
 
 % miscellany
@@ -238,16 +238,16 @@ att_receiver(Req, Length) ->
 %%      also be passed to further constrain the query. See <a href=
 %%      "http://wiki.apache.org/couchdb/HTTP_Document_API#All_Documents">
 %%      all_docs</a> for details
--spec all_docs(dbname(), callback(), [] | tuple(), #mrargs{}) ->
+-spec all_docs(dbname(), [{atom(), any()}], callback(), [] | tuple(), #mrargs{}) ->
     {ok, [any()]}.
-all_docs(DbName, Callback, Acc0, #mrargs{} = QueryArgs) when
+all_docs(DbName, Options, Callback, Acc0, #mrargs{} = QueryArgs) when
         is_function(Callback, 2) ->
-    fabric_view_all_docs:go(dbname(DbName), QueryArgs, Callback, Acc0);
+    fabric_view_all_docs:go(dbname(DbName), opts(Options), QueryArgs, Callback, Acc0);
 
 %% @doc convenience function that takes a keylist rather than a record
 %% @equiv all_docs(DbName, Callback, Acc0, kl_to_query_args(QueryArgs))
-all_docs(DbName, Callback, Acc0, QueryArgs) ->
-    all_docs(DbName, Callback, Acc0, kl_to_query_args(QueryArgs)).
+all_docs(DbName, Options, Callback, Acc0, QueryArgs) ->
+    all_docs(DbName, Options, Callback, Acc0, kl_to_query_args(QueryArgs)).
 
 
 -spec changes(dbname(), callback(), any(), #changes_args{} | [{atom(),any()}]) ->
@@ -343,7 +343,7 @@ design_docs(DbName) ->
     ({error, Reason}, _Acc) ->
         {error, Reason}
     end,
-    fabric:all_docs(dbname(DbName), Callback, [], QueryArgs).
+    fabric:all_docs(dbname(DbName), [?ADMIN_CTX], Callback, [], QueryArgs).
 
 %% @doc forces a reload of validation functions, this is performed after
 %%      design docs are update

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/90958590/src/fabric_rpc.erl
----------------------------------------------------------------------
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index d2e6486..cd68d35 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -15,7 +15,7 @@
 -export([get_db_info/1, get_doc_count/1, get_update_seq/1]).
 -export([open_doc/3, open_revs/4, get_missing_revs/2, get_missing_revs/3,
     update_docs/3]).
--export([all_docs/2, changes/3, map_view/4, reduce_view/4, group_info/2]).
+-export([all_docs/3, changes/3, map_view/4, reduce_view/4, group_info/2]).
 -export([create_db/1, delete_db/1, reset_validation_funs/1, set_security/3,
     set_revs_limit/3, create_shard_db_doc/2, delete_shard_db_doc/2]).
 -export([get_all_security/2]).
@@ -48,8 +48,8 @@ changes(DbName, Options, StartSeq) ->
         rexi:reply(Error)
     end.
 
-all_docs(DbName, #mrargs{keys=undefined} = Args) ->
-    {ok, Db} = get_or_create_db(DbName, []),
+all_docs(DbName, Options, #mrargs{keys=undefined} = Args) ->
+    {ok, Db} = get_or_create_db(DbName, Options),
     VAcc0 = #vacc{db=Db},
     couch_mrview:query_all_docs(Db, Args, fun view_cb/2, VAcc0).
 

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/90958590/src/fabric_view_all_docs.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_all_docs.erl b/src/fabric_view_all_docs.erl
index 701afa7..e5ed7b3 100644
--- a/src/fabric_view_all_docs.erl
+++ b/src/fabric_view_all_docs.erl
@@ -12,16 +12,16 @@
 
 -module(fabric_view_all_docs).
 
--export([go/4]).
--export([open_doc/3]). % exported for spawn
+-export([go/5]).
+-export([open_doc/4]). % exported for spawn
 
 -include_lib("fabric/include/fabric.hrl").
 -include_lib("mem3/include/mem3.hrl").
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
 
-go(DbName, #mrargs{keys=undefined} = QueryArgs, Callback, Acc0) ->
-    Workers = fabric_util:submit_jobs(mem3:shards(DbName),all_docs,[QueryArgs]),
+go(DbName, Options, #mrargs{keys=undefined} = QueryArgs, Callback, Acc0) ->
+    Workers = fabric_util:submit_jobs(mem3:shards(DbName),all_docs,[Options, QueryArgs]),
     #mrargs{limit = Limit, skip = Skip} = QueryArgs,
     State = #collector{
         query_args = QueryArgs,
@@ -46,7 +46,7 @@ go(DbName, #mrargs{keys=undefined} = QueryArgs, Callback, Acc0) ->
     end;
 
 
-go(DbName, QueryArgs, Callback, Acc0) ->
+go(DbName, Options, QueryArgs, Callback, Acc0) ->
     #mrargs{
         direction = Dir,
         include_docs = IncludeDocs,
@@ -56,7 +56,7 @@ go(DbName, QueryArgs, Callback, Acc0) ->
     } = QueryArgs,
     {_, Ref0} = spawn_monitor(fun() -> exit(fabric:get_doc_count(DbName)) end),
     SpawnFun = fun(Key) ->
-        spawn_monitor(?MODULE, open_doc, [DbName, Key, IncludeDocs])
+        spawn_monitor(?MODULE, open_doc, [DbName, Options, Key, IncludeDocs])
     end,
     MaxJobs = all_docs_concurrency(),
     Keys1 = case Dir of
@@ -186,8 +186,8 @@ doc_receive_loop(Keys, Pids, SpawnFun, MaxJobs, Callback, AccIn) ->
         end
     end.
 
-open_doc(DbName, Id, IncludeDocs) ->
-    Row = case fabric:open_doc(DbName, Id, [deleted]) of
+open_doc(DbName, Options, Id, IncludeDocs) ->
+    Row = case fabric:open_doc(DbName, Id, [deleted | Options]) of
     {not_found, missing} ->
         Doc = undefined,
         #view_row{key=Id};


Mime
View raw message