From a033c82a3c656a8f53feb60b5b149680771ac247 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 11 Sep 2018 15:39:09 +0200 Subject: Use DETS to store shard & peer list to disk --- shard/lib/app/blockstore.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shard/lib/app/blockstore.ex') diff --git a/shard/lib/app/blockstore.ex b/shard/lib/app/blockstore.ex index 8e4fddc..5e93135 100644 --- a/shard/lib/app/blockstore.ex +++ b/shard/lib/app/blockstore.ex @@ -109,10 +109,10 @@ defmodule SApp.BlockStore do end def ask_random_peers(state, key) do - peers = :ets.lookup(:shard_peer_db, state.shard_id) + peers = Shard.Manager.get_shard_peers(state.shard_id) |> Enum.shuffle |> Enum.take(3) - for {_, peer} <- peers do + for peer <- peers do Shard.Manager.send(peer, {state.shard_id, state.path, {:get, key}}) end end -- cgit v1.2.3