summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2018-02-28 10:34:01 -0600
committerGitHub <noreply@github.com>2018-02-28 10:34:01 -0600
commit79b5cd14bd1f2bf1d567867c8000b327310241ee (patch)
tree62794f97e64c808ac3af0cce73b8b9f6059998d0
parent796bb41ccd797e2a6e8b8dd10cc7b538d91af942 (diff)
parent00c43cd88cfea7899200cd50fe6953849e8d07c9 (diff)
downloadcouchdb-79b5cd14bd1f2bf1d567867c8000b327310241ee.tar.gz
Merge pull request #24 from cloudant/COUCHDB-3287-pluggable-storage-engines
Update to use pluggable storage engine APIs
-rw-r--r--src/custodian/src/custodian_util.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/custodian/src/custodian_util.erl b/src/custodian/src/custodian_util.erl
index 0fe38c467..ed96d9cb6 100644
--- a/src/custodian/src/custodian_util.erl
+++ b/src/custodian/src/custodian_util.erl
@@ -47,17 +47,17 @@ fold_dbs(Acc, Fun) ->
{ok, Db} = ensure_dbs_exists(),
try
State0 = #state{live=Live, safe=Safe, n=N, callback=Fun, db=Db, acc=Acc},
- {ok, _, State1} = couch_db:enum_docs(Db, fun fold_dbs/3, State0, []),
+ {ok, State1} = couch_db:fold_docs(Db, fun fold_dbs1/2, State0, []),
State1#state.acc
after
couch_db:close(Db)
end.
-fold_dbs(#full_doc_info{id = <<"_design/", _/binary>>}, _, Acc) ->
+fold_dbs1(#full_doc_info{id = <<"_design/", _/binary>>}, Acc) ->
{ok, Acc};
-fold_dbs(#full_doc_info{deleted=true}, _, Acc) ->
+fold_dbs1(#full_doc_info{deleted=true}, Acc) ->
{ok, Acc};
-fold_dbs(#full_doc_info{id = Id} = FDI, _, State) ->
+fold_dbs1(#full_doc_info{id = Id} = FDI, State) ->
InternalAcc = case count_conflicts(FDI) of
0 ->
State#state.acc;
@@ -67,7 +67,8 @@ fold_dbs(#full_doc_info{id = Id} = FDI, _, State) ->
Shards = load_shards(State#state.db, FDI),
Rs = [R || #shard{range=R} <- lists:ukeysort(#shard.range, Shards)],
ActualN = [{R1, [N || #shard{node=N,range=R2} <- Shards, R1 == R2]} || R1 <- Rs],
- fold_dbs(Id, ActualN, State#state{acc=InternalAcc});
+ fold_dbs(Id, ActualN, State#state{acc=InternalAcc}).
+
fold_dbs(_Id, [], Acc) ->
{ok, Acc};
fold_dbs(Id, [{Range, Nodes}|Rest], State) ->