redisrules

package
v0.72.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package redisrules holds the one Redis endpoint rule set. It lives here so that both config and cache/redis can call it: config must not import cache/redis, and cache/redis must not import config (ADR-108). Each caller adapts a Violation into its own error type and key namespace.

Index

Constants

View Source
const (
	ModeStandalone = "standalone"
	ModeCluster    = "cluster"
)

Transport modes. An empty Mode means ModeStandalone.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Host, Mode, Username, Password         string
	Port, Database, PoolSize               int
	DialTimeout, ReadTimeout, WriteTimeout time.Duration
	TLSEnabled                             bool
	TLS                                    clienttls.Material
}

Endpoint is the transport-facing slice of a Redis configuration.

type Violation

type Violation struct {
	Field   string   // relative to the redis block: "port", "tls.cafile"
	Message string   // reason only, config wording
	Missing bool     // required value absent (host)
	Allowed []string // closed set: {"1-65535"}, {"standalone", "cluster"}
}

Violation is the first broken rule. Field and any sibling key named in Message are relative to the redis block, so each caller prefixes its own namespace.

func Check

func Check(e *Endpoint) *Violation

Check returns the first violation in a fixed order — host, port, mode, cluster needs database 0, username, database range, poolsize, dial, read, write, TLS structure — or nil when the endpoint is valid. An empty Mode is standalone. It fills nothing, mutates nothing and reads no files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL