summaryrefslogtreecommitdiff
path: root/src/plop_sup.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plop_sup.erl')
-rw-r--r--src/plop_sup.erl18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plop_sup.erl b/src/plop_sup.erl
index 442eabc..55d6e9a 100644
--- a/src/plop_sup.erl
+++ b/src/plop_sup.erl
@@ -26,11 +26,11 @@ permanent_worker(Name, StartFunc, Modules) ->
10000,
worker, Modules}.
-perm_database_children(DB) ->
- lists:filtermap(fun ({Name, DBName, ConfigName}) ->
+database_children(DB) ->
+ lists:filtermap(fun ({Module, Name, DBName, ConfigName}) ->
case application:get_env(plop, ConfigName) of
{ok, Path} ->
- {true, permanent_worker(Name, {perm, start_link, [DBName, Path]})};
+ {true, permanent_worker(Name, {Module, start_link, [DBName, Path]})};
undefined ->
false
end
@@ -39,11 +39,13 @@ perm_database_children(DB) ->
%% Supervisor callback
init([]) ->
Services = application:get_env(plop, services, []),
- DBChildren = perm_database_children([
- {the_entryhash_db, entryhash_db, entryhash_root_path},
- {the_indexforhash_db, indexforhash_db, indexforhash_root_path},
- {the_entry_db, entry_db, entry_root_path}
- ]),
+ DBChildren = database_children([
+ {perm, the_entryhash_db, entryhash_db, entryhash_root_path},
+ {perm, the_indexforhash_db, indexforhash_db, indexforhash_root_path},
+ {perm, the_entry_db, entry_db, entry_root_path},
+ {index, the_index_db, index_db, index_path},
+ {index, the_newentries_db, newentries_db, newentries_path}
+ ]),
Children = [permanent_worker(the_db, {db, start_link, []}, [db]),
permanent_worker(the_storagedb, {storagedb, start_link, []}),
permanent_worker(fsync, {fsyncport, start_link, []})],