You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2020/04/10 21:31:03 UTC
[couchdb] 04/11: Update to use `fabric2_db:get_design_docs/1`
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 3e1c822794990cab06002c4d8a7a6ac22069d9a4
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Mar 25 14:33:15 2020 -0500
Update to use `fabric2_db:get_design_docs/1`
---
src/fabric/src/fabric2_index.erl | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/src/fabric/src/fabric2_index.erl b/src/fabric/src/fabric2_index.erl
index 8d0affe..9a6607e 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).