summaryrefslogtreecommitdiff
path: root/src/plop.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plop.erl')
-rw-r--r--src/plop.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plop.erl b/src/plop.erl
index 57febf5..0c85b21 100644
--- a/src/plop.erl
+++ b/src/plop.erl
@@ -189,12 +189,8 @@ get_logid() ->
testing_get_pubkey() ->
gen_server:call(?MODULE, {test, pubkey}).
-fill_in_entry({_Index, LeafHash, notfetched}) ->
- db:get_by_leaf_hash(LeafHash).
-
storage_nodes() ->
- {ok, Value} = application:get_env(plop, storage_nodes, {ok, []}),
- Value.
+ application:get_env(plop, storage_nodes, []).
storage_nodes_quorum() ->
{ok, Value} = application:get_env(plop, storage_nodes_quorum),
@@ -222,6 +218,7 @@ send_storage_entrycommitted(URLBase, EntryHash, TreeLeafHash) ->
[], [{sync, false}]).
store_at_all_nodes(Nodes, {LogEntry, TreeLeafHash, EntryHash}, From, State) ->
+ lager:debug("leafhash ~p", [TreeLeafHash]),
OwnRequestId = make_ref(),
Completion =
@@ -240,6 +237,7 @@ store_at_all_nodes(Nodes, {LogEntry, TreeLeafHash, EntryHash}, From, State) ->
{From, Completion,
storage_nodes_quorum()}}),
+ lager:debug("send requests to ~p", [Nodes]),
RequestIds = [send_storage_sendentry(URLBase, LogEntry, TreeLeafHash)
|| URLBase <- Nodes],
PlopWithRequests =
@@ -250,6 +248,9 @@ store_at_all_nodes(Nodes, {LogEntry, TreeLeafHash, EntryHash}, From, State) ->
end, PlopWithOwn, RequestIds),
PlopWithRequests.
+fill_in_entry({_Index, LeafHash, notfetched}) ->
+ db:get_by_leaf_hash(LeafHash).
+
%%%%%%%%%%%%%%%%%%%%
handle_call(stop, _From, Plop) ->
{stop, normal, stopped, Plop};
@@ -267,6 +268,7 @@ handle_call({get, logid}, _From,
{reply, LogID, Plop};
handle_call({add, {LogEntry, TreeLeafHash, EntryHash}}, From, Plop) ->
+ lager:debug("add leafhash ~p", [TreeLeafHash]),
case storage_nodes() of
[] ->
ok = db:add(TreeLeafHash, EntryHash, LogEntry, ht:size()),