# Distrimon
A library to help you have a singleton process in your BEAM cluster.
## Notes
This library starts a process on each node, and each tries to start the process.
The first one that registers the process wins, and no additional process is spawned on winner node.
In other nodes, one process in place of this singleton is spawned that monitors the process.
In case it dies, this process also dies and is restarted by supervisor, and tries to register it again.
Again, the first one wins.
In case of net splits, this singleton process exists on each split separately. When splits are joined later on,
your defined resolver module is called to handle the conflict, killing one process and keeping the other one(s).
Note that you can use the same resolver to have multiple singletons. A resolver is just there to resolve
conflicts, and you can use one resolving strategy to have multiple singletons.
For an example of a resolver, see module `Distrimon.Resolver.Random`
## Installation
This package can be installed by adding `distrimon` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:distrimon, "~> 0.1.0"}
]
end
```
Docs can be found at <https://hexdocs.pm/distrimon>.
## TODO
1. Write tests, as there are none.
2. Write more example resolvers.
3. Explore the possibility of tolerating temporary splits, using a strategy defined by user.