couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject fabric commit: updated refs/heads/2938-use-ddoc-cache-in-filtered-changes to 8f42a7d
Date Thu, 21 Jan 2016 22:57:56 GMT
Repository: couchdb-fabric
Updated Branches:
  refs/heads/2938-use-ddoc-cache-in-filtered-changes [created] 8f42a7db6


Support fetch ddoc logic for filtered changes feeds


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

Branch: refs/heads/2938-use-ddoc-cache-in-filtered-changes
Commit: 8f42a7db69137896efd3c8a44899a9b83f848a10
Parents: d67049c
Author: Russell Branca <chewbranca@apache.org>
Authored: Thu Jan 21 22:55:13 2016 +0000
Committer: Russell Branca <chewbranca@apache.org>
Committed: Thu Jan 21 22:55:13 2016 +0000

----------------------------------------------------------------------
 src/fabric_rpc.erl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/8f42a7db/src/fabric_rpc.erl
----------------------------------------------------------------------
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index 2554f91..9b88c7f 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -47,7 +47,18 @@ changes(DbName, #changes_args{} = Args, StartSeq, DbOptions) ->
     changes(DbName, [Args], StartSeq, DbOptions);
 changes(DbName, Options, StartVector, DbOptions) ->
     set_io_priority(DbName, DbOptions),
-    #changes_args{dir=Dir} = Args = lists:keyfind(changes_args, 1, Options),
+    Args0 = lists:keyfind(changes_args, 1, Options),
+    #changes_args{dir=Dir, filter_fun=Filter} = Args0,
+    Args = case Filter of
+        {fetch, Style, Req, {DDocId, Rev}, FName} ->
+            {ok, DDoc} = ddoc_cache:open_doc(mem3:dbname(DbName), DDocId, Rev),
+            Args0#changes_args{
+                filter_fun={custom, Style, Req, DDoc, FName}
+            };
+        _ ->
+            Args0
+    end,
+
     DbOpenOptions = Args#changes_args.db_open_options ++ DbOptions,
     case get_or_create_db(DbName, DbOpenOptions) of
     {ok, Db} ->


Mime
View raw message