diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-03-25 14:33:15 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-04-10 16:30:49 -0500 |
commit | 3e1c822794990cab06002c4d8a7a6ac22069d9a4 (patch) | |
tree | ca3e63a32622495575e020da567f13299478927f | |
parent | 3c0a017b63b31b1e8d62707c0b909d8f24def1ba (diff) | |
download | couchdb-3e1c822794990cab06002c4d8a7a6ac22069d9a4.tar.gz |
Update to use `fabric2_db:get_design_docs/1`
-rw-r--r-- | src/fabric/src/fabric2_index.erl | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/fabric/src/fabric2_index.erl b/src/fabric/src/fabric2_index.erl index 8d0affebb..9a6607e2e 100644 --- a/src/fabric/src/fabric2_index.erl +++ b/src/fabric/src/fabric2_index.erl @@ -158,7 +158,7 @@ process_updates_iter([Db | Rest], Cont) -> process_db(DbName) when is_binary(DbName) -> {ok, Db} = fabric2_db:open(DbName, [?ADMIN_CTX]), fabric2_fdb:transactional(Db, fun(TxDb) -> - DDocs1 = get_design_docs(TxDb), + DDocs1 = fabric2_db:get_design_docs(TxDb), DDocs2 = lists:filter(fun should_update/1, DDocs1), DDocs3 = shuffle(DDocs2), build_indices(TxDb, DDocs3) @@ -178,22 +178,6 @@ registrations() -> application:get_env(fabric, indices, []). -get_design_docs(Db) -> - Callback = fun - ({meta, _}, Acc) -> {ok, Acc}; - (complete, Acc) -> {ok, Acc}; - ({row, Row}, Acc) -> {ok, [get_doc(Db, Row) | Acc]} - end, - {ok, DDocs} = fabric2_db:fold_design_docs(Db, Callback, [], []), - DDocs. - - -get_doc(Db, Row) -> - {_, DocId} = lists:keyfind(id, 1, Row), - {ok, #doc{deleted = false} = Doc} = fabric2_db:open_doc(Db, DocId, []), - Doc. - - should_update(#doc{body = {Props}}) -> couch_util:get_value(<<"autoupdate">>, Props, true). |