Liking cljdoc? Tell your friends :D

lb.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!)

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!)
raw docstring

disable-hot-reload!clj

(disable-hot-reload!)

Disable hot reload and cleanup resources.

Disable hot reload and cleanup resources.
sourceraw docstring

enable-hot-reload!clj

(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.
sourceraw docstring

get-reload-stateclj

(get-reload-state)

Get current reload state for debugging.

Get current reload state for debugging.
sourceraw docstring

hot-reload-enabled?clj

(hot-reload-enabled?)

Check if hot reload is currently enabled.

Check if hot reload is currently enabled.
sourceraw docstring

register-apply-fns!clj

(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.
sourceraw docstring

register-sighup-handler!clj

(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.
sourceraw docstring

reload-config!clj

(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 ...}
sourceraw docstring

reload-config-from-map!clj

(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 ...}
sourceraw docstring

start-file-watcher!clj

(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.
sourceraw docstring

stop-file-watcher!clj

(stop-file-watcher! {:keys [stop-fn]})

Stop the file watcher.

Stop the file watcher.
sourceraw docstring

unregister-sighup-handler!clj

(unregister-sighup-handler! previous-handler)

Restore default SIGHUP behavior.

Restore default SIGHUP behavior.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close