# GlobalChild

This library is a clone of
[Highlander](, an easy-to-use cluster
singleton utility for Elixir clusters.

It contains minor tweaks from the original implementation, notably the support
for transient and temporary children.

## Installation

def deps do
    {:global_child, "~> 0.1.1"},

## [Documentation](

The documentation is available on [](

<!-- moduledoc_start -->

## Usage

To start a globally unique child, wrap its child spec with a `GlobalChild`
child spec tuple:

children = [
  # ...
  {GlobalChild, child: {MyApp.Worker, name: {:global, :worker}}},
  # ...


* `:child` – Required. The child specification of the global process.
* `:debug` – Optional, defaults to `false`. Enables logger debug message when
* `:sleep` – Optional, defaults to `0`. A duration in milliseconds to sleep
  for before attempting to start the global child.  This is useful to let the
  cluster form and allow `:global` to synchronize with other nodes.  Without a
  delay, the process may start on several nodes, though eventually there will
  only be one left after `:global` is synchronized.  See `:global.sync/0` if
  you need to enforce the synchronization.

## Configuration

The default values for `:debug` and `:sleep` options can be set at the
configuration level.  Those values are pulled at runtime.

config :global_child,
debug: true,
sleep: 1500