# `Tinkex.PoolKey`
[🔗](https://github.com/North-Shore-AI/tinkex/blob/v0.4.0/lib/tinkex/pool_key.ex#L1)

Centralized pool key generation and URL normalization.

Ensures every pool key follows the `{normalized_base_url, pool_type}` convention
and derives deterministic Finch pool names per host + operation type.

# `build`

```elixir
@spec build(String.t(), atom()) :: {destination :: String.t(), atom()}
```

Build the Finch pool key tuple for the given base URL and pool type.

# `destination`

```elixir
@spec destination(String.t()) :: String.t()
```

Normalize a base URL into a Finch destination URL string (scheme + host + port).

Finch >= 0.20 expects pool keys as binaries (not tuples). Paths are stripped
because connection pools are keyed per host/port, not per path.

# `normalize_base_url`

```elixir
@spec normalize_base_url(String.t()) :: String.t()
```

Normalize a base URL for consistent pool keys.

Downcases the host and strips default ports (80 for http, 443 for https). Paths
are discarded because Finch pools connections per host, not per path.

## Examples

    iex> Tinkex.PoolKey.normalize_base_url("https://example.com:443")
    "https://example.com"

# `pool_name`

```elixir
@spec pool_name(atom(), String.t(), atom()) :: atom()
```

Derive a Finch pool name for a base pool, base URL, and pool type.

Names are deterministic per base URL + pool type pair to ensure isolation across
session/training/sampling/futures/telemetry pools.

# `resolve_pool_name`

```elixir
@spec resolve_pool_name(atom(), String.t(), atom()) :: atom()
```

Resolve the running Finch pool for a given pool type, falling back to the base
pool name if the typed pool has not been started.

---

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