summaryrefslogtreecommitdiff
path: root/src/plop.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2014-10-25 15:22:09 +0200
committerMagnus Ahltorp <map@kth.se>2014-10-25 15:22:09 +0200
commit2483f0cf09ccc4cf73558c7a85bbb51a72d29c3a (patch)
treed618ac06c64d92b5a350955391d5abd352563878 /src/plop.erl
parent868a029e39ec8e9aa368da917146d088edee4d2f (diff)
Optimize db:get_by_indices by not fetching entry and implementing index:getrange
Diffstat (limited to 'src/plop.erl')
-rw-r--r--src/plop.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plop.erl b/src/plop.erl
index 0523613..0c85b21 100644
--- a/src/plop.erl
+++ b/src/plop.erl
@@ -248,12 +248,17 @@ 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};
handle_call({get, {index, Start, End}}, _From, Plop) ->
- {reply, db:get_by_indices(Start, End, {sorted, false}), Plop};
+ {reply, lists:map(fun (E) -> fill_in_entry(E) end,
+ db:get_by_indices(Start, End, {sorted, false})),
+ Plop};
handle_call({get, {hash, EntryHash}}, _From, Plop) ->
{reply, db:get_by_entry_hash(EntryHash), Plop};