summaryrefslogtreecommitdiff
path: root/apps/couch/src/couch_view.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2011-10-04 13:11:12 -0700
committerAdam Kocoloski <adam@cloudant.com>2011-10-04 13:11:12 -0700
commitda7284ed2844926c7df0efef12ba30d8e2e6d039 (patch)
tree10fa2d5cf35bfae4d48fc632924cec98ee02a22a /apps/couch/src/couch_view.erl
parentb57aadd742e4f8cc925ba4f005ae658c43a7c5b4 (diff)
parent4e19639a64d3033e1cc7c22a0b7404d277643c78 (diff)
Merge pull request #67 from cloudant/12645-merge_latest_1.1.x
Diffstat (limited to 'apps/couch/src/couch_view.erl')
-rw-r--r--apps/couch/src/couch_view.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/couch/src/couch_view.erl b/apps/couch/src/couch_view.erl
index 05174245..8d479d7e 100644
--- a/apps/couch/src/couch_view.erl
+++ b/apps/couch/src/couch_view.erl
@@ -260,8 +260,16 @@ fold_fun(Fun, [KV|Rest], {KVReds, Reds}, Acc) ->
fold(#view{btree=Btree}, Fun, Acc, Options) ->
WrapperFun =
- fun(KV, Reds, Acc2) ->
- fold_fun(Fun, expand_dups([KV],[]), Reds, Acc2)
+ fun(visit, KV, Reds, Acc2) ->
+ fold_fun(Fun, expand_dups([KV],[]), Reds, Acc2);
+ (traverse, LK, Red, Acc2)
+ when is_function(Fun, 4) ->
+ Fun(traverse, LK, Red, Acc2);
+ (traverse, _LK, Red, {_, Skip, _, _} = Acc2)
+ when Skip >= element(1, Red) ->
+ {skip, setelement(2, Acc2, Skip - element(1, Red))};
+ (traverse, _, _, Acc2) ->
+ {ok, Acc2}
end,
{ok, _LastReduce, _AccResult} = couch_btree:fold(Btree, WrapperFun, Acc, Options).