aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/cli/cli.ex
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-09-11 15:39:09 +0200
committerAlex Auvolat <alex@adnab.me>2018-09-11 15:39:09 +0200
commita033c82a3c656a8f53feb60b5b149680771ac247 (patch)
treebc3cb9a6954aebcfd1a0c5f61d367e1083802c3e /shard/lib/cli/cli.ex
parente92969db3f0a2093da16eb7db18c9db49225a719 (diff)
downloadshard-a033c82a3c656a8f53feb60b5b149680771ac247.tar.gz
shard-a033c82a3c656a8f53feb60b5b149680771ac247.zip
Use DETS to store shard & peer list to disk
Diffstat (limited to 'shard/lib/cli/cli.ex')
-rw-r--r--shard/lib/cli/cli.ex10
1 files changed, 5 insertions, 5 deletions
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 ->