Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aditimalladi committed Oct 22, 2018
1 parent 1c8eede commit 7f35e3b
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 335 deletions.
Empty file added 1014836
Empty file.
Empty file added 544976,
Empty file.
Empty file added 748402,
Empty file.
5 changes: 2 additions & 3 deletions lib/chief.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ defmodule Chief do
GenServer.call(server, {:get_succ, node})
end

# deleting an existing node
def delete(server, node) do
GenServer.cast(server, {:delete, node})
end
Expand Down Expand Up @@ -63,8 +64,6 @@ defmodule Chief do
{:noreply, state}
end



def handle_call({:get}, _from, state) do
{:reply, state[:node_list], state}
end
Expand All @@ -75,7 +74,7 @@ defmodule Chief do

def handle_call({:get_succ, node}, _from, state) do
node_list = state[:node_list]
node_i = Enum.find_index(node_list, fn i -> i==node end)
IO.inspect node_i = Enum.find_index(node_list, fn i -> i==node end)
{:reply, Enum.fetch!(node_list, node_i+1), state}
end
end
Loading

0 comments on commit 7f35e3b

Please sign in to comment.