OTPLabs Core
OTPLabs Core is lib that provides:
-
Horde, Mnesia Supervisor and Horde Registry.
- Those loads nodes dynamically when they start. You should use libcluster to make nodes avaliable via Node.list().
-
Horde and Mnesia NodeObserver GenServer.
- Those recives notitication when a node up and down and update Horde and mnesia cluster.
Installation
If available in Hex, the package can be installed
by adding otplabs to your list of dependencies in mix.exs:
def deps do
[
{:otplabs, "~> 0.1.0"}
]
endDeclare Supervisors, Registry and NodeObserver as a children in you application.
defmodule MyApp.Application do
use Application
@impl true
def start(type, args) do
topologies = ....
children = [
{Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]},
OTPLabs.Horde.Registry,
OTPLabs.Horde.Supervisor,
OTPLabs.Horde.NodeObserver,
OTPLabs.Mnesia.Supervisor,
OTPLabs.Mnesia.NodeObserver,
]
Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
end
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/optlabs.