Compare commits

..

No commits in common. "0b8bbca40bb638f51096e2e6244570a2db5dc844" and "ceb4daaf570bbd5d433924ee0b7f9cb617e33dab" have entirely different histories.

2 changed files with 7 additions and 19 deletions

View File

@ -31,17 +31,9 @@ defmodule Amethyst.Application do
child_spec: DynamicSupervisor.child_spec([]), child_spec: DynamicSupervisor.child_spec([]),
name: Amethyst.GameMetaSupervisor name: Amethyst.GameMetaSupervisor
}, },
{PartitionSupervisor, {Amethyst.BlockRegistry, %{}},
child_spec: Amethyst.BlockRegistry.child_spec(%{}),
name: Amethyst.BlockRegistry},
Supervisor.child_spec( Supervisor.child_spec(
{Task, fn -> {Task, fn -> Amethyst.DataGenerator.generate_and_populate_data(:latest, "/tmp/server.jar", "/tmp/amethyst-generated") end}, id: Amethyst.DataGenerator)
Amethyst.DataGenerator.generate_and_populate_data(
:latest,
"/tmp/server.jar",
"/tmp/amethyst-generated")
end},
id: Amethyst.DataGenerator)
] ]
children = case Application.fetch_env!(:amethyst, :port) do children = case Application.fetch_env!(:amethyst, :port) do

View File

@ -22,8 +22,9 @@ defmodule Amethyst.BlockRegistry do
""" """
require Logger require Logger
def start_link(map) do def start_link(initial) do
GenServer.start_link(__MODULE__, map) Logger.info("Starting BlockRegistry")
GenServer.start_link(__MODULE__, initial, name: __MODULE__)
end end
def init(map) do def init(map) do
@ -43,11 +44,6 @@ defmodule Amethyst.BlockRegistry do
end end
end end
def handle_call(:debug, _from, state) do
Logger.debug("BlockRegistry state: #{inspect(state)}")
{:reply, :ok, state}
end
@doc """ @doc """
Adds a block state to the registry. Adds a block state to the registry.
@ -58,7 +54,7 @@ defmodule Amethyst.BlockRegistry do
""" """
@spec add(String.t(), map(), integer()) :: :ok @spec add(String.t(), map(), integer()) :: :ok
def add(id, bs, bsi) do def add(id, bs, bsi) do
GenServer.cast({:via, PartitionSupervisor, {__MODULE__, id}}, {:add, id, bs, bsi}) GenServer.cast(__MODULE__, {:add, id, bs, bsi})
end end
@doc """ @doc """
@ -68,6 +64,6 @@ defmodule Amethyst.BlockRegistry do
""" """
@spec get(String.t(), map() | nil) :: integer() | nil @spec get(String.t(), map() | nil) :: integer() | nil
def get(id, bs \\ %{}) do def get(id, bs \\ %{}) do
GenServer.call({:via, PartitionSupervisor, {__MODULE__, id}}, {:get, id, bs}) GenServer.call(__MODULE__, {:get, id, bs})
end end
end end