Tinkex.PoolKey (Tinkex v0.2.2)
View SourceCentralized 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.
Summary
Functions
Build the Finch pool key tuple for the given base URL and pool type.
Normalize a base URL into a Finch destination URL string (scheme + host + port).
Normalize a base URL for consistent pool keys.
Derive a Finch pool name for a base pool, base URL, and pool type.
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.
Functions
Build the Finch pool key tuple for the given base URL and pool type.
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 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"
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 the running Finch pool for a given pool type, falling back to the base pool name if the typed pool has not been started.