]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: copy constructor for config proxy
authorMykola Golub <mgolub@suse.com>
Wed, 12 Sep 2018 08:59:59 +0000 (11:59 +0300)
committerMykola Golub <mgolub@suse.com>
Thu, 20 Sep 2018 07:35:18 +0000 (10:35 +0300)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/common/config_proxy.h

index e9b6b39b6263ab39c3ba54b98e177c074e0a3837..e54f357bccedef9d8d8ef90cca4a7a3672db37c1 100644 (file)
 // the legacy settings with arrow operator, and the new-style config with its
 // member methods.
 class ConfigProxy {
+  static ConfigValues get_config_values(const ConfigProxy &config_proxy) {
+    Mutex::Locker locker(config_proxy.lock);
+    return config_proxy.values;
+  }
+
   /**
    * The current values of all settings described by the schema
    */
@@ -30,6 +35,11 @@ public:
     : config{values, obs_mgr, is_daemon},
       lock{"ConfigProxy", true, false}
   {}
+  explicit ConfigProxy(const ConfigProxy &config_proxy)
+    : values(get_config_values(config_proxy)),
+      config{values, obs_mgr, config_proxy.config.is_daemon},
+      lock{"ConfigProxy", true, false}
+  {}
   const ConfigValues* operator->() const noexcept {
     return &values;
   }