Skip to main content

Module config_watcher

Module config_watcher 

Source
Expand description

Hot-reload watcher for the server config file.

Watches the config file (default /etc/reddb/config.json, override via REDDB_CONFIG_FILE) for changes and applies hot-reloadable keys to red_config without a server restart.

Hot-reloadable: red.logging.*, slow_query.*, disk_space.critical_pct.

Restart-required: everything else. Detected changes to non-hot-reloadable fields emit OperatorEvent::ConfigChangeRequiresRestart and are NOT applied. Hot-reloadable fields in the same reload ARE applied.

Atomicity: if JSON parse fails, nothing is applied (parse-then-apply).

Linux: inotify on the parent directory catches atomic rename-swaps (vim’s default save pattern: write temp → rename(2)IN_MOVED_TO). Non-Linux: falls back to a 5-second poll loop.

Structs§

ConfigWatcher
Background watcher that hot-reloads the server config file on change.