]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: deepish_copy_from()
authorSage Weil <sage@inktank.com>
Fri, 24 Jan 2014 19:03:26 +0000 (11:03 -0800)
committerSage Weil <sage@inktank.com>
Tue, 28 Jan 2014 19:10:33 +0000 (11:10 -0800)
Make a deep(ish) copy of another OSDMap.  Unfortunatley we can't make the
compiler-generated copy operator/constructors private until c++11.  :(

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit bd54b9841b9255406e56cdc7269bddb419453304)

src/osd/OSDMap.h

index bd8f09b682e315849d06d9e729fc153e125f8a02..2c65078069e76a8fa20b24888adcc81476c11f6d 100644 (file)
@@ -232,6 +232,25 @@ private:
     memset(&fsid, 0, sizeof(fsid));
   }
 
+  // no copying
+  /* oh, how i long for c++11...
+private:
+  OSDMap(const OSDMap& other) = default;
+  const OSDMap& operator=(const OSDMap& other) = default;
+public:
+  */
+
+  void deepish_copy_from(const OSDMap& o) {
+    pg_temp.reset(new map<pg_t,vector<int> >(*o.pg_temp));
+    osd_uuid.reset(new vector<uuid_d>(*o.osd_uuid));
+
+    // NOTE: this still references shared entity_addr_t's.
+    osd_addrs.reset(new addrs_s(*o.osd_addrs));
+
+    // NOTE: we do not copy crush.  note that apply_incremental will
+    // allocate a new CrushWrapper, though.
+  }
+
   // map info
   const uuid_d& get_fsid() const { return fsid; }
   void set_fsid(uuid_d& f) { fsid = f; }