summaryrefslogtreecommitdiff
path: root/src/db.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/db.erl')
-rw-r--r--src/db.erl17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/db.erl b/src/db.erl
index f204f76..5ad49ec 100644
--- a/src/db.erl
+++ b/src/db.erl
@@ -52,7 +52,7 @@ sendsth_verified() ->
end.
indexsize() ->
- index:indexsize(index_path()).
+ index:indexsize(index_db).
init(_Args) ->
{ok, []}.
@@ -182,11 +182,6 @@ terminate(_Reason, _State) ->
%%%%%%%%%%%%%%%%%%%%
%% The meat.
-% Table for Index -> Leaf hash
-index_path() ->
- {ok, Value} = application:get_env(plop, index_path),
- Value.
-
% File that stores the number of verified entries
verifiedsize_path() ->
{ok, Value} = application:get_env(plop, verifiedsize_path),
@@ -209,10 +204,10 @@ index_for_leafhash(LeafHash) ->
end.
leafhash_for_index(Index) ->
- index:get(index_path(), Index).
+ index:get(index_db, Index).
leafhash_for_indices(Start, End) ->
- index:getrange(index_path(), Start, End).
+ index:getrange(index_db, Start, End).
leafhash_for_entryhash(EntryHash) ->
perm:getvalue(entryhash_db, EntryHash).
@@ -235,7 +230,7 @@ handle_call(stop, _From, State) ->
{stop, normal, stopped, State};
handle_call({add_index_nosync_noreverse, {LeafHash, Index}}, _From, State) ->
- ok = index:add_nosync(index_path(), Index, LeafHash),
+ ok = index:add_nosync(index_db, Index, LeafHash),
{reply, ok, State}.
indexforhash_nosync(LeafHash, Index) ->
@@ -248,6 +243,4 @@ indexforhash_dosync() ->
ok.
index_sync() ->
- Basepath = index_path(),
- ok = util:fsync([Basepath, filename:dirname(Basepath)]),
- ok.
+ index:sync(index_db).