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:02 UTC

[couchdb] 03/11: Move process_db/1 to match the logical progression

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 3c0a017b63b31b1e8d62707c0b909d8f24def1ba
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Mar 25 16:07:43 2020 -0500

    Move process_db/1 to match the logical progression
    
    Functions are easier to read and process if they're defined in the order
    that they are referenced.
    
    Co-Authored-By: Nick Vatamaniuc <va...@apache.org>
---
 src/fabric/src/fabric2_index.erl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/fabric/src/fabric2_index.erl b/src/fabric/src/fabric2_index.erl
index 098d6ed..8d0affe 100644
--- a/src/fabric/src/fabric2_index.erl
+++ b/src/fabric/src/fabric2_index.erl
@@ -155,6 +155,16 @@ process_updates_iter([Db | Rest], Cont) ->
     process_updates_iter(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),
+        DDocs2 = lists:filter(fun should_update/1, DDocs1),
+        DDocs3 = shuffle(DDocs2),
+        build_indices(TxDb, DDocs3)
+    end).
+
+
 build_indices(_TxDb, []) ->
     [];
 
@@ -168,16 +178,6 @@ registrations() ->
     application:get_env(fabric, indices, []).
 
 
-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),
-        DDocs2 = lists:filter(fun should_update/1, DDocs1),
-        DDocs3 = shuffle(DDocs2),
-        build_indices(TxDb, DDocs3)
-    end).
-
-
 get_design_docs(Db) ->
     Callback = fun
         ({meta, _}, Acc) ->  {ok, Acc};