Documentation
¶
Overview ¶
Package dbparams is the typed allowlist of engine tuning parameters a managed database accepts. Deny by default: a name absent from the allowlist is refused, and every accepted value is re-rendered from its parsed number or enum, so no caller string ever reaches a command line.
Index ¶
- Variables
- func Args(engine string, params map[string]string, lim Limits) []string
- func ClampMemory(engine, name, value string, lim Limits) (string, bool)
- func Denied(engine string) []string
- func Fingerprint(args []string) string
- func Incompatible(engine, version string, params map[string]string, lim Limits) []string
- func MemoryCeiling(limitBytes int64, adminMB int) int64
- func Validate(engine string, params map[string]string, lim Limits) (map[string]string, error)
- func ValidateOne(engine, name, value string, lim Limits) (string, error)
- type Family
- type Kind
- type Limits
- type Spec
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedEngine = errors.New("this engine takes no tuning parameters")
ErrUnsupportedEngine is returned for an engine with no allowlist.
Functions ¶
func Args ¶
Args renders applied parameters as separate argv elements. Entries that fail validation are dropped, so a stored row edited by hand never reaches the engine.
func ClampMemory ¶
ClampMemory lowers a valid memory parameter above lim's ceiling to the ceiling, in the value's own unit, so a lower cap still bounds the engine instead of the parameter falling back to an uncapped default.
func Fingerprint ¶
Fingerprint is a short hash of the rendered args, "" when there are none, so a database without parameters keeps its existing container label set.
func Incompatible ¶
Incompatible returns the sorted names in params that the given engine version refuses, through the same validators staging uses plus the version gates.
func MemoryCeiling ¶
MemoryCeiling is 75 percent of a memory limit, or the admin ceiling when the database has none.
Types ¶
type Family ¶
type Family string
Family groups engines that share a flag syntax and a parameter list.
type Spec ¶
type Spec struct {
Name string `json:"name"`
Kind Kind `json:"kind"`
Default string `json:"default"`
Min float64 `json:"min,omitempty"`
Max float64 `json:"max,omitempty"`
Options []string `json:"options,omitempty"`
ConnectionCap bool `json:"connection_cap,omitempty"`
MemoryCap bool `json:"memory_cap,omitempty"`
Description string `json:"description"`
}
Spec describes one allowlisted parameter. Min and Max are bytes for KindSize. ConnectionCap marks the parameter the admin ceiling bounds.