diff options
Diffstat (limited to 'shard/lib/manager.ex')
-rw-r--r-- | shard/lib/manager.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shard/lib/manager.ex b/shard/lib/manager.ex index 990bcea..c178e2f 100644 --- a/shard/lib/manager.ex +++ b/shard/lib/manager.ex @@ -17,6 +17,11 @@ defprotocol Shard.Manifest do Get the module in question. """ def module(manifest) + + @doc""" + Check if manifest is valid + """ + def is_valid?(manifest) end defmodule Shard.Manager do @@ -189,6 +194,8 @@ defmodule Shard.Manager do end defp find_or_start(state, shard_id, manifest) do + true = Shard.Manifest.is_valid?(manifest) + case :dets.lookup(@shard_db, shard_id) do [] -> :dets.insert(@shard_db, {shard_id, manifest, cached(), nil}) @@ -200,6 +207,7 @@ defmodule Shard.Manager do case :ets.lookup(:shard_procs, {shard_id, nil}) do [] -> {:ok, pid} = apply(Shard.Manifest.module(manifest), :start_link, [manifest]) + GenServer.cast(pid, :send_deps) :ets.insert(:shard_procs, {{shard_id, nil}, pid}) state = Map.put(state, pid, {shard_id, nil}) {pid, state} |