Skip to content

Commit

Permalink
Updated for Elixir v1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
whitfin committed Jul 29, 2018
1 parent c4d3298 commit 0bcb6a1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
33 changes: 23 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
language: elixir
elixir:
- 1.5.2
- 1.4.5
- 1.3.4
- 1.2.6
- 1.7
- 1.6
- 1.5
- 1.4
- 1.3
- 1.2
otp_release:
- 20.1
- 21.0
- 20.3
- 19.3
- 19.0
- 18.3
matrix:
exclude:
- elixir: 1.3.4
otp_release: 20.1
- elixir: 1.2.6
otp_release: 20.1
- elixir: 1.7
otp_release: 18.3
- elixir: 1.6
otp_release: 18.3
- elixir: 1.5
otp_release: 21.0
- elixir: 1.4
otp_release: 21.0
- elixir: 1.3
otp_release: 21.0
- elixir: 1.3
otp_release: 20.3
- elixir: 1.2
otp_release: 21.0
- elixir: 1.2
branches:
only:
- master
Expand Down
24 changes: 9 additions & 15 deletions lib/eternal/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,26 @@ defmodule Eternal.Server do
{ :ok, { table, opts } }
end

@doc """
Handles the transfer of an ETS table from an owner to an heir, with the server
receiving this message being the heir. We log the change before starting a new
heir and triggering a monitor to occur against this server (the new owner).
"""
# Handles the transfer of an ETS table from an owner to an heir, with the server
# receiving this message being the heir. We log the change before starting a new
# heir and triggering a monitor to occur against this server (the new owner).
def handle_info({ :"ETS-TRANSFER", table, from, reason }, { table, opts } = state) do
Priv.log("Table '#{table}' #{reason}ed to #{Priv.spid(self())} via #{Priv.spid(from)}", opts)
{ :noreply, state }
end

@doc """
Handles the termination of an heir, through the usual GenServer stop functions.
In this scenario the heir will attempt to message through to the owner in order
to inform it to create a new heir, which it will then carry out.
"""
# Handles the termination of an heir, through the usual GenServer stop functions.
# In this scenario the heir will attempt to message through to the owner in order
# to inform it to create a new heir, which it will then carry out.
def handle_info({ :"ETS-HEIR-UP", table, pid }, { table, opts } = state) do
Priv.heir(table, pid)
Priv.log("Assigned new heir #{Priv.spid(pid)}", opts)
{ :noreply, state }
end

@doc """
Catch all info handler to ensure that we don't crash for whatever reason when
an unrecognised message is sent. In theory, a crash shouldn't be an issue, but
it's better logically to avoid doing so here.
"""
# Catch all info handler to ensure that we don't crash for whatever reason when
# an unrecognised message is sent. In theory, a crash shouldn't be an issue, but
# it's better logically to avoid doing so here.
def handle_info(_msg, state),
do: { :noreply, state }
end
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ defmodule Eternal.Mixfile do
tool: ExCoveralls
],
preferred_cli_env: [
"docs": :docs,
"coveralls": :test,
docs: :docs,
coveralls: :test,
"coveralls.html": :test,
"coveralls.travis": :test
]
Expand Down

0 comments on commit 0bcb6a1

Please sign in to comment.