]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: remove deprecated get_tracked_conf_keys() 62328/head
authorRonen Friedman <rfriedma@redhat.com>
Sun, 16 Mar 2025 11:40:52 +0000 (06:40 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sun, 16 Mar 2025 12:22:19 +0000 (07:22 -0500)
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 <rfriedma@redhat.com>
src/common/config_cacher.h
src/common/config_obs.h
src/common/config_obs_mgr.h

index 577aac442b68c33141c2659d10e686d743fb338f..d956e0515e38e45d3dfd5507dc349e542f46a201 100644 (file)
 
 /**
  * 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 <typename ValueT>
 class md_config_cacher_t : public md_config_obs_t {
index a36d4c2aca0208036f064d227a24d4e12d3ef855..2d8416031a4df6d670d22de68631439ee414cd6b 100644 (file)
@@ -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<std::string> get_tracked_keys() const noexcept {
-    return {};
-  }
+  virtual std::vector<std::string> get_tracked_keys() const noexcept = 0;
 
   /// React to a configuration change.
   virtual void handle_conf_change(const ConfigProxy& conf,
index 805e0d16c43a6c36d3866207ebcbb7a16923d9d4..6081498be1f5d87d0cd74e29f60f36222d0290fe 100644 (file)
@@ -65,13 +65,6 @@ void ObserverMgr<ConfigObs>::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<class ConfigObs>