Pristine.PoolKey (Pristine v0.3.1)

Copy Markdown View Source

Centralized pool key generation and URL normalization.

Ensures every pool key follows the {normalized_base_url, pool_type} convention while keeping process names source-owned. URL- and resource-derived values are never converted into atoms.

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.

Return the configured source-owned Finch pool name for a 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(base_url, pool_type)

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

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

destination(url)

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

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

normalize_base_url(url)

@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.

pool_name(base_pool, base_url, pool_type)

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

Return the configured source-owned Finch pool name for a base URL and pool type.

resolve_pool_name(base_pool, base_url, pool_type)

@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.