From 0727321d899e3cc5e874e25b352ae95f00e6519f Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Sun, 16 Mar 2025 06:40:52 -0500 Subject: [PATCH] common: remove deprecated get_tracked_conf_keys() This is the last PR in a set of PRs that replaced the deprecated get_tracked_conf_keys() with the new get_tracked_keys(). Signed-off-by: Ronen Friedman --- src/common/config_cacher.h | 13 ++++++------- src/common/config_obs.h | 19 ++++--------------- src/common/config_obs_mgr.h | 7 ------- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/common/config_cacher.h b/src/common/config_cacher.h index 577aac442b68c..d956e0515e38e 100644 --- a/src/common/config_cacher.h +++ b/src/common/config_cacher.h @@ -20,13 +20,12 @@ /** * A simple class to cache a single configuration value. - * Points to note: - * - as get_tracked_conf_keys() must return a pointer to a null-terminated - * array of C-strings, 'keys' - an array - is used to hold the sole key - * that this observer is interested in. - * - the const cast should be removed once we change the - * get_tracked_conf_keys() to return const char* const * (or something - * similar). + * + * The md_config_cacher_t object registers itself to receive + * notifications of changes to the specified single configuration + * option. When the option changes, the new value is stored + * in an atomic variable. The value can be accessed using + * the dereference operator. */ template class md_config_cacher_t : public md_config_obs_t { diff --git a/src/common/config_obs.h b/src/common/config_obs.h index a36d4c2aca020..2d8416031a4df 100644 --- a/src/common/config_obs.h +++ b/src/common/config_obs.h @@ -33,27 +33,16 @@ class md_config_obs_impl { public: virtual ~md_config_obs_impl() {} - /** @brief Get a table of strings specifying the configuration keys in which the object is interested. - * This is called when the object is subscribed to configuration changes with add_observer(). - * The returned table should not be freed until the observer is removed with remove_observer(). - * Note that it is not possible to change the set of tracked keys without re-subscribing. - * - * DEPRECATED! Use get_tracked_keys() instead. - */ - virtual const char** get_tracked_conf_keys() const { - return nullptr; - } - /** * Returns a vector of strings specifying the configuration keys in which - * the object is interested. + * the object is interested. This is called when the object is subscribed to + * configuration changes with add_observer(). + * * Note - the strings in the returned vector are 'moveable'. The caller * (ostensibly the observer manager) is expected to move them into its * map. */ - virtual std::vector get_tracked_keys() const noexcept { - return {}; - } + virtual std::vector get_tracked_keys() const noexcept = 0; /// React to a configuration change. virtual void handle_conf_change(const ConfigProxy& conf, diff --git a/src/common/config_obs_mgr.h b/src/common/config_obs_mgr.h index 805e0d16c43a6..6081498be1f5d 100644 --- a/src/common/config_obs_mgr.h +++ b/src/common/config_obs_mgr.h @@ -65,13 +65,6 @@ void ObserverMgr::add_observer(ConfigObs* observer) for (auto&& k : observer->get_tracked_keys()) { observers.emplace(std::move(k), ptr); } - - // legacy observer interface: - if (const char** keys = observer->get_tracked_conf_keys(); keys) { - for (const char** k = keys; *k; ++k) { - observers.emplace(*k, ptr); - } - } } template -- 2.39.5