RedisServerWrapper.Connection (redis_server_wrapper v0.7.4)

Copy Markdown View Source

A Redis client connection shared by lifecycle and topology APIs.

The connection keeps the endpoint, authentication, and TLS client settings together so readiness, commands, health checks, shutdown, and persisted Manager instances all use the same transport.

Summary

Functions

Returns the redis-cli connection argument vector.

Returns environment variables used to pass secrets to redis-cli.

Returns a stable, filesystem-safe endpoint identifier.

Returns a concise endpoint label suitable for errors and logs.

Returns the listener used for ownership and availability checks.

Creates and validates a connection.

Returns a Redis URL for display or client handoff.

Returns a copy of a TCP or TLS connection using another port.

Types

t()

@type t() :: %RedisServerWrapper.Connection{
  host: String.t() | nil,
  password: String.t() | nil,
  port: :inet.port_number() | nil,
  socket: String.t() | nil,
  tls_ca_cert_dir: String.t() | nil,
  tls_ca_cert_file: String.t() | nil,
  tls_client_cert_file: String.t() | nil,
  tls_client_key_file: String.t() | nil,
  tls_insecure: boolean(),
  tls_server_name: String.t() | nil,
  transport: transport(),
  username: String.t() | nil
}

transport()

@type transport() :: :tcp | :tls | :unix

Functions

cli_args(connection, opts \\ [])

@spec cli_args(
  t(),
  keyword()
) :: [String.t()]

Returns the redis-cli connection argument vector.

cli_env(connection)

@spec cli_env(t()) :: [{String.t(), String.t()}]

Returns environment variables used to pass secrets to redis-cli.

id(connection)

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

Returns a stable, filesystem-safe endpoint identifier.

label(connection)

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

Returns a concise endpoint label suitable for errors and logs.

listener(connection)

@spec listener(t()) :: {:tcp, String.t(), :inet.port_number()} | {:unix, String.t()}

Returns the listener used for ownership and availability checks.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates and validates a connection.

url(connection)

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

Returns a Redis URL for display or client handoff.

with_port(connection, port)

@spec with_port(t(), :inet.port_number()) :: t()

Returns a copy of a TCP or TLS connection using another port.