View Source NoNoncense.MachineId.ConflictGuard (NoNoncense v0.0.5)

Guards against machine ID conflicts between nodes. If a new node joins the cluster with the same ID, it is sent the machine IDs of all existing nodes, will become aware of the ID conflict and will call the on_conflict callback that can take action to prevent bad stuff from happening (for example, that the uniqueness guarantee of NoNoncense will no longer hold).

By default, the on_conflict callback emergeny shuts down the entire node using :erlang.halt/1 with status code 111.

Of course, all of this only works if the nodes are actually connected to one another.

Summary

Functions

Returns a specification to start this module under a supervisor.

Let's get this puppy going!

Types

opts()

@type opts() :: [
  name: module(),
  on_conflict: (-> any()),
  machine_id: non_neg_integer()
]

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(opts()) :: GenServer.on_start()

Let's get this puppy going!