You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2016/02/10 23:30:39 UTC
[2/2] fabric commit: updated
refs/heads/2938-use-ddoc-cache-in-filtered-changes to 8bb97fc
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/8bb97fcf
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/8bb97fcf
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/8bb97fcf
Branch: refs/heads/2938-use-ddoc-cache-in-filtered-changes
Commit: 8bb97fcf59d44374e4e0516a33293d22a9c2308c
Parents: 31be532
Author: Russell Branca <ch...@apache.org>
Authored: Thu Jan 21 22:55:13 2016 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Wed Feb 10 22:21:06 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/8bb97fcf/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} ->