aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib
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 /shardweb/lib
parente92969db3f0a2093da16eb7db18c9db49225a719 (diff)
downloadshard-a033c82a3c656a8f53feb60b5b149680771ac247.tar.gz
shard-a033c82a3c656a8f53feb60b5b149680771ac247.zip
Use DETS to store shard & peer list to disk
Diffstat (limited to 'shardweb/lib')
-rw-r--r--shardweb/lib/shard_web/channels/room_channel.ex4
-rw-r--r--shardweb/lib/shard_web/templates/room/show.html.eex2
-rw-r--r--shardweb/lib/shard_web/views/page_view.ex2
-rw-r--r--shardweb/lib/shard_web/views/room_view.ex2
4 files changed, 5 insertions, 5 deletions
diff --git a/shardweb/lib/shard_web/channels/room_channel.ex b/shardweb/lib/shard_web/channels/room_channel.ex
index 2dd733b..bb41a74 100644
--- a/shardweb/lib/shard_web/channels/room_channel.ex
+++ b/shardweb/lib/shard_web/channels/room_channel.ex
@@ -6,8 +6,8 @@ defmodule ShardWeb.RoomChannel do
def join("room:" <> room_name, payload, socket) do
if authorized?(payload) 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}
pid = case List.keyfind(list, room_name, 0) do
nil ->
diff --git a/shardweb/lib/shard_web/templates/room/show.html.eex b/shardweb/lib/shard_web/templates/room/show.html.eex
index a689017..5f28cc5 100644
--- a/shardweb/lib/shard_web/templates/room/show.html.eex
+++ b/shardweb/lib/shard_web/templates/room/show.html.eex
@@ -1,7 +1,7 @@
<ul class="nav nav-tabs">
<%= for shard <- shard_list() do %>
<%= case shard do %>
- <%= {_, {:chat, name}, _} -> %>
+ <%= {_, %SApp.Chat.Manifest{channel: name}, _} -> %>
<li class="<%= if name == @room do "active" else "" end %>">
<a href="<%= room_path(@conn, :show, name) %>">#<%= name %></a>
</li>
diff --git a/shardweb/lib/shard_web/views/page_view.ex b/shardweb/lib/shard_web/views/page_view.ex
index 8d39191..533c9e5 100644
--- a/shardweb/lib/shard_web/views/page_view.ex
+++ b/shardweb/lib/shard_web/views/page_view.ex
@@ -2,7 +2,7 @@ defmodule ShardWeb.PageView do
use ShardWeb, :view
def peer_list do
- :ets.tab2list(:peer_db)
+ Shard.Manager.list_peers
end
def peer_id_to_str(id) do
diff --git a/shardweb/lib/shard_web/views/room_view.ex b/shardweb/lib/shard_web/views/room_view.ex
index b2d7ebe..7c102cc 100644
--- a/shardweb/lib/shard_web/views/room_view.ex
+++ b/shardweb/lib/shard_web/views/room_view.ex
@@ -2,6 +2,6 @@ defmodule ShardWeb.RoomView do
use ShardWeb, :view
def shard_list do
- :ets.tab2list(:shard_db)
+ Shard.Manager.list_shards
end
end