kilok
July 16, 2018, 8:44pm
1
Hi, trying to understand the code-base.
My question is why is there a supervisor in between the Keys module?
It seems to me that the structure was to have the main supervisor only supervise supervisors. Also, is there any reason to not use child_spec
?
Hey @kilok ,
Thank you for your question.
It’s been forwarded to our dev team and they’ll get back to you.
Regards,
The AE Team
Hello @kilok ,
I assume you talk about the elixir-node? Could you link me to the files you are referring to, so I can check better.
Kind regards,
Philipp from the Dev Team
kilok
July 19, 2018, 10:10pm
4
Hey Phillip,
Here is the supervisor which suppervises the Key Supervisor: elixir-node/aecore.ex at 179a87dc10febbf49d697d268e1c44e1691dcff6 · aeternity/elixir-node · GitHub
Here is the Key’s supervisor:
defmodule Aecore.Keys.Worker.Supervisor do
use Supervisor
def start_link() do
Supervisor.start_link(__MODULE__, :ok)
end
def init(:ok) do
children = [
worker(Aecore.Keys.Worker, [])
]
supervise(children, strategy: :one_for_one)
end
end
Then the Keys supervisor supervises this Key’s Genserver:
defmodule Aecore.Keys.Worker do
@moduledoc """
Key manager for AE node
"""
use GenServer
alias Aecore.Structures.TxData
alias Aecore.Structures.SignedTx
@filename_pub "key.pub"
@filename_priv "key"
def start_link() do
GenServer.start_link(
__MODULE__,
%{
pub: nil,
priv: nil,
pass: nil,
keys_dir: nil,
This file has been truncated. show original
I’m wondering if there was any particular reason for this design instead of child_spec?
Thanks for reading
Hey @kilok ,
Thanks for your question.
@philipp.chain will get back to you on that as soon as possible.
Regards,
The AE team
Hello @kilok
When we started working on the project, we used the convinient design of the Supervisor.Spec module across the whole project. Since it is now depricated we will soon update our codebase to the new changes/design patterns.
We actually checked on this again and this was fixed way back with the following commit → Elixir 1.5 child specs - removed deprecated Supervisor.Spec module · aeternity/elixir-node@8f3cec4 · GitHub
Kind regards,
Georgi from the Elixir Dev Team
3 Likes
Hello @kilok , with the latest Pull Request we should have removed all remaining deprecated supervisor spec patterns. [GH-505] replace deprecated supervisor.spec by thepiwo · Pull Request #605 · aeternity/elixir-node · GitHub
It would be great to hear a few more thoughts you have about our elixir codebase!
kilok
September 13, 2018, 1:42pm
8
Hey @philipp.chain ,
Thanks for the update. If I find anything else that is interesting, I will be reach out again.
Thanks for the reply and have a good day
2 Likes