]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/config_proxy: added 'get_config_values' method
authorJason Dillaman <dillaman@redhat.com>
Thu, 29 Oct 2020 14:06:06 +0000 (10:06 -0400)
committerCory Snyder <csnyder@iland.com>
Tue, 8 Jun 2021 18:01:00 +0000 (14:01 -0400)
Expose the ability to retrieve the ConfigValues from an existing
ConfigProxy object. When combined with the newly exposed
'set_config_values' method, it will allow the safe bulk-updating
of configuration options. This also removes the original private
static version of 'get_config_values'.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit d47c1804778fb7bada8e2a0892cdfc77db18ada4)

src/common/config_proxy.h

index fc8dd1c210d806552d44e65d5bb42aef48fa916a..136e8be73847c207ce9cf919025192be431a45aa 100644 (file)
 // member methods.
 namespace ceph::common{
 class ConfigProxy {
-  static ConfigValues get_config_values(const ConfigProxy &config_proxy) {
-    std::lock_guard locker(config_proxy.lock);
-    return config_proxy.values;
-  }
-
   /**
    * The current values of all settings described by the schema
    */
@@ -115,7 +110,7 @@ public:
     : config{values, obs_mgr, is_daemon}
   {}
   explicit ConfigProxy(const ConfigProxy &config_proxy)
-    : values(get_config_values(config_proxy)),
+    : values(config_proxy.get_config_values()),
       config{values, obs_mgr, config_proxy.config.is_daemon}
   {}
   const ConfigValues* operator->() const noexcept {
@@ -124,6 +119,10 @@ public:
   ConfigValues* operator->() noexcept {
     return &values;
   }
+  ConfigValues get_config_values() const {
+    std::lock_guard l{lock};
+    return values;
+  }
   void set_config_values(const ConfigValues& val) {
 #ifndef WITH_SEASTAR
     std::lock_guard l{lock};