Service for consensus based process selection/election service.
Can register processes with {via, pes, term()} tupple.
gen_server:start({via, pes, <<"merlin">>}, wizard_mod, [], []).gen_server:call({via, pes, <<"merlin">>}, do_magic).Join to cluster:
pes:join('node_b@serverfarm1').Leave a node from cluster
pes:leave('node_d@serverfarm1').Paxos like consensus algorithm.
When a new value should be registered a statem process started to guide through the registration process.
After a successful registration that statem process keep alive and monitoring the started process. It is also responsible update/heartbeat the registry periodically.
It is possible to update the process id in PES's catalog. But pls keep it in ming that it is tou responsibility to design you own handoff method.
Here is some example:
  NewMerlinServer = gen_server:start(wizard_mod, [], []),
  MerlinPid = pes:whereis_name(<<"merlin">>),
  gen_server:call(MerlinPid, {handoff, NewMerlinServer}),
  pes:update(<<"merlin">>, NewMerlinServer),
  gen_server:terminate(MerlinPid).$ rebar3 compile