# `Hassock.Supervisor`
[🔗](https://github.com/bbangert/hassock/blob/v0.3.0/lib/hassock/supervisor.ex#L1)

Optional convenience supervisor that wires a `Hassock.Connection`,
(optionally) a `Hassock.Cache` and (optionally) a `Hassock.RegistryCache`
together under a `one_for_all` strategy — if any crashes, all restart from
a clean slate.

Equivalent to writing the pair into your own supervision tree by hand. Use
this when you don't need finer-grained control.

## Options

  * `:config` — `%Hassock.Config{}` (required)
  * `:cache` — when `true`, also start a `Hassock.Cache` (default: `false`)
  * `:registries` — when `true`, also start a `Hassock.RegistryCache`
    (default: `false`)
  * `:controller` — pid that should receive events from the topmost layer
    (the cache if present, else the connection) and from the registry
    cache. Default: caller of `start_link/1`.
  * `:name` — register the supervisor under this name (optional)
  * `:connection_name` — register the connection under this name (default: `Hassock.Connection`)
  * `:cache_name` — register the cache under this name (default: `Hassock.Cache`)
  * `:registry_cache_name` — register the registry cache under this name
    (default: `Hassock.RegistryCache`)

## Example

    {:ok, _sup} = Hassock.Supervisor.start_link(
      config: %Hassock.Config{url: "...", token: "..."},
      cache: true,
      controller: self()
    )
    receive do
      {:hassock_cache, _cache, :ready} -> :ok
    end

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
