ExESDBGater.Config (ex_esdb_gater v0.8.0)

Configuration validation and normalization for ExESDBGater.

This module provides standardized configuration handling with proper validation, error handling, and normalization to ensure consistent behavior across the system.

Summary

Functions

Gets the cluster mode configuration.

Gets the connection retry interval configuration.

Gets the health check interval configuration.

Gets the maximum connections configuration.

Gets the pool size configuration.

Gets the port configuration.

Checks if libcluster should be used for node discovery.

Validates and normalizes configuration for ExESDBGater.

Validates libcluster topology configuration.

Types

config()

@type config() :: Keyword.t()

gater_config()

@type gater_config() :: map()

Functions

cluster_mode?(config)

@spec cluster_mode?(config()) :: boolean()

Gets the cluster mode configuration.

connection_retry_interval(config)

@spec connection_retry_interval(config()) :: pos_integer()

Gets the connection retry interval configuration.

health_check_interval(config)

@spec health_check_interval(config()) :: pos_integer()

Gets the health check interval configuration.

max_connections(config)

@spec max_connections(config()) :: pos_integer()

Gets the maximum connections configuration.

pool_size(config)

@spec pool_size(config()) :: pos_integer()

Gets the pool size configuration.

port(config)

@spec port(config()) :: non_neg_integer()

Gets the port configuration.

use_libcluster?(config)

@spec use_libcluster?(config()) :: boolean()

Checks if libcluster should be used for node discovery.

validate(config)

@spec validate(config()) :: {:ok, gater_config()} | {:error, {atom(), term()}}

Validates and normalizes configuration for ExESDBGater.

Options

  • :cluster_mode - Whether to run in cluster mode (default: false)
  • :port - Port to listen on for HTTP API (default: 4001)
  • :max_connections - Maximum number of concurrent connections (default: 1000)
  • :pool_size - Size of worker pools (default: 10)
  • :use_libcluster - Whether to use libcluster for node discovery (default: true)
  • :connection_retry_interval - Interval between connection retries in ms (default: 5000)
  • :health_check_interval - Interval for health checks in ms (default: 30000)

Examples

iex> ExESDBGater.Config.validate([port: 4001])
{:ok, %{port: 4001, cluster_mode: false, ...}}

validate_libcluster_config(config)

@spec validate_libcluster_config(config()) :: {:ok, config()} | {:error, term()}

Validates libcluster topology configuration.