diff options
author | Magnus Ahltorp <map@kth.se> | 2015-10-01 12:39:28 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2015-11-11 13:32:37 +0100 |
commit | 0a3e6aafee314eaf9e5343c4cad89a9e2ae1d913 (patch) | |
tree | 2ceb97ebf656a26ac384e0e550dc2070d1b7ec72 /src/plop_sup.erl | |
parent | 55820add0bda7ac926f11ee49b232dc11d6fe39c (diff) |
Change index.erl to use gen_server and named databases.
Prefetch indices in frontend:fetchmissingentries/2.
Diffstat (limited to 'src/plop_sup.erl')
-rw-r--r-- | src/plop_sup.erl | 18 |
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, []})], |