# `ExDataSketch.Config`
[🔗](https://github.com/thanos/ex_data_sketch/blob/main/lib/ex_data_sketch/config.ex#L1)

Per-family default option overrides from Application config.

Every sketch family's `new/1` (or, for `ExDataSketch.XorFilter`,
`build/2`) resolves its options by merging explicitly-passed `opts`
over whatever this module returns -- explicit opts always win.
Configure via a single flat `:defaults` key, keyed by the same atoms
`ExDataSketch.sketches/0` uses:

    config :ex_data_sketch,
      backend: ExDataSketch.Backend.Rust,
      defaults: [
        hll: [p: 16],
        cqf: [q: 20, r: 8],
        bloom: [capacity: 50_000]
      ]

This mirrors the existing flat `config :ex_data_sketch, :backend, ...`
/ `:storage` / `:telemetry` keys already used elsewhere in this
library, rather than introducing a new per-module config convention.

`ExDataSketch.FilterChain.new/0` takes no options at all, so it has no
corresponding `:filter_chain` defaults key.

# `merge_defaults`

```elixir
@spec merge_defaults(
  atom(),
  keyword()
) :: keyword()
```

Merges `family`'s configured default options underneath `opts`.

`opts` always wins on any key present in both. Unconfigured families
(no `:defaults` entry, or no `:defaults` key at all) return `opts`
unchanged.

## Examples

    iex> ExDataSketch.Config.merge_defaults(:hll, [])
    []

    iex> ExDataSketch.Config.merge_defaults(:hll, [p: 12])
    [p: 12]

---

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