Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
config_watcher.h File Reference

Configuration hot-reload support with file system watching. More...

#include "config_loader.h"
#include "unified_config.h"
#include <kcenon/common/patterns/result.h>
#include <atomic>
#include <chrono>
#include <deque>
#include <filesystem>
#include <functional>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <string>
#include <thread>
#include <vector>
Include dependency graph for config_watcher.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kcenon::common::config::config_change_event
 Information about a configuration change event. More...
 
struct  kcenon::common::config::config_snapshot
 Represents a configuration snapshot for version history. More...
 
class  kcenon::common::config::config_watcher
 Monitors configuration files for changes and supports hot-reload. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::common
 Core interfaces.
 
namespace  kcenon::common::config
 
namespace  kcenon::common::config::watcher_error_codes
 Error codes specific to config_watcher.
 

Variables

constexpr int kcenon::common::config::watcher_error_codes::watch_failed = 2001
 
constexpr int kcenon::common::config::watcher_error_codes::reload_failed = 2002
 
constexpr int kcenon::common::config::watcher_error_codes::validation_failed = 2003
 
constexpr int kcenon::common::config::watcher_error_codes::rollback_failed = 2004
 
constexpr int kcenon::common::config::watcher_error_codes::not_started = 2005
 
constexpr int kcenon::common::config::watcher_error_codes::already_running = 2006
 
constexpr int kcenon::common::config::watcher_error_codes::platform_not_supported = 2007
 

Detailed Description

Configuration hot-reload support with file system watching.

This header provides the config_watcher class for monitoring configuration file changes at runtime and automatically reloading configuration.

Features:

  • Cross-platform file system watching (inotify/kqueue/ReadDirectoryChanges)
  • Change callback system with old/new configuration comparison
  • Configuration version tracking
  • Automatic rollback on validation failure
  • Hot-reloadable vs. non-reloadable field distinction

Platform Support:

  • Linux: inotify
  • macOS/BSD: kqueue
  • Windows: ReadDirectoryChangesW
See also
TICKET-203 for implementation requirements.
unified_config.h for hot_reloadable field metadata.
config_loader.h for loading implementation.

Definition in file config_watcher.h.