Configuration hot reload for the load balancer.
Provides:
Usage: ;; Enable hot reload for a config file (enable-hot-reload! "/etc/lb/config.edn")
;; Manual reload (reload-config!)
;; Disable hot reload (disable-hot-reload!)
Configuration hot reload for the load balancer. Provides: - File watching (inotify-based via Java NIO WatchService) - SIGHUP signal handling - Incremental configuration updates - Validation before apply with rollback on failure Usage: ;; Enable hot reload for a config file (enable-hot-reload! "/etc/lb/config.edn") ;; Manual reload (reload-config!) ;; Disable hot reload (disable-hot-reload!)
(disable-hot-reload!)Disable hot reload and cleanup resources.
Disable hot reload and cleanup resources.
(enable-hot-reload! config-path
&
{:keys [watch-file? sighup? debounce-ms]
:or {watch-file? true sighup? true debounce-ms 500}})Enable hot reload for the specified config file.
Options: :watch-file? - Enable file watching (default true) :sighup? - Enable SIGHUP handling (default true) :debounce-ms - File change debounce period (default 500ms)
Returns true if enabled successfully.
Enable hot reload for the specified config file. Options: :watch-file? - Enable file watching (default true) :sighup? - Enable SIGHUP handling (default true) :debounce-ms - File change debounce period (default 500ms) Returns true if enabled successfully.
(get-reload-state)Get current reload state for debugging.
Get current reload state for debugging.
(hot-reload-enabled?)Check if hot reload is currently enabled.
Check if hot reload is currently enabled.
(register-apply-fns! fns)Register the apply functions from core.clj. Called during core initialization to avoid circular dependency.
Register the apply functions from core.clj. Called during core initialization to avoid circular dependency.
(register-sighup-handler! reload-fn)Register a handler for SIGHUP signal. On SIGHUP, calls reload-fn.
Returns previous handler that can be restored.
Register a handler for SIGHUP signal. On SIGHUP, calls reload-fn. Returns previous handler that can be restored.
(reload-config!)(reload-config! config-path)Manually trigger a configuration reload.
If path is provided, loads from that file. Otherwise, uses the last known config path.
Returns {:success? bool :changes {...} :error ...}
Manually trigger a configuration reload.
If path is provided, loads from that file.
Otherwise, uses the last known config path.
Returns {:success? bool :changes {...} :error ...}(reload-config-from-map! config-map)Reload configuration from an in-memory config map. Useful for programmatic config changes.
Returns {:success? bool :changes {...} :error ...}
Reload configuration from an in-memory config map.
Useful for programmatic config changes.
Returns {:success? bool :changes {...} :error ...}(start-file-watcher! config-path
on-change-fn
&
{:keys [debounce-ms] :or {debounce-ms 500}})Start a background daemon that watches config file for changes. Uses Java NIO WatchService (which uses inotify on Linux).
Parameters: config-path - Path to configuration file on-change-fn - Function called with config path when file changes
Options: :debounce-ms - Debounce period to coalesce rapid changes (default 500ms)
Returns a control map with :stop-fn to stop the watcher.
Start a background daemon that watches config file for changes. Uses Java NIO WatchService (which uses inotify on Linux). Parameters: config-path - Path to configuration file on-change-fn - Function called with config path when file changes Options: :debounce-ms - Debounce period to coalesce rapid changes (default 500ms) Returns a control map with :stop-fn to stop the watcher.
(stop-file-watcher! {:keys [stop-fn]})Stop the file watcher.
Stop the file watcher.
(unregister-sighup-handler! previous-handler)Restore default SIGHUP behavior.
Restore default SIGHUP behavior.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |