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/cli/cli.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'shard/lib/cli') diff --git a/shard/lib/cli/cli.ex b/shard/lib/cli/cli.ex index 2fbf8c2..c3afe8f 100644 --- a/shard/lib/cli/cli.ex +++ b/shard/lib/cli/cli.ex @@ -14,7 +14,7 @@ defmodule SCLI do prompt = case pid do nil -> "(no channel) #{nick}: " _ -> - {:chat, chan} = GenServer.call(pid, :manifest) + %SApp.Chat.Manifest{channel: chan} = GenServer.call(pid, :manifest) "##{chan} #{nick}: " end @@ -56,8 +56,8 @@ defmodule SCLI do defp handle_command(pid, ["list"]) do IO.puts "List of known channels:" - for {_chid, manifest, _chpid} <- :ets.tab2list(:shard_db) do - {:chat, chan} = manifest + for {_chid, manifest, _chpid} <- Shard.Manager.list_shards do + %SApp.Chat.Manifest{channel: chan} = manifest IO.puts "##{chan}" end pid @@ -72,8 +72,8 @@ defmodule SCLI do end defp handle_command(_pid, ["join", qchan]) do - list = for {_chid, manifest, chpid} <- :ets.tab2list(:shard_db), - {:chat, chan} = manifest, + list = for {_chid, manifest, chpid} <- Shard.Manager.list_shards, + %SApp.Chat.Manifest{channel: chan} = manifest, do: {chan, chpid} case List.keyfind(list, qchan, 0) do nil -> -- cgit v1.2.3