]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: add custom move ctor/assignment for Transaction 7303/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 21 Jan 2016 15:02:39 +0000 (10:02 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 22 Jan 2016 16:02:34 +0000 (11:02 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/os/ObjectStore.h

index d85c87d2a099175c4225fadd456cb46f1a52511a..5ba83bf373a44346fbb8e27f2bb80abe5d2ef61c 100644 (file)
@@ -503,6 +503,53 @@ public:
       decode(dp);
     }
 
+    // override default move operations to reset default values
+    Transaction(Transaction&& other) :
+      data(std::move(other.data)),
+      osr(other.osr),
+      use_tbl(other.use_tbl),
+      tbl(std::move(other.tbl)),
+      coll_index(std::move(other.coll_index)),
+      object_index(std::move(other.object_index)),
+      coll_id(other.coll_id),
+      object_id(other.object_id),
+      data_bl(std::move(other.data_bl)),
+      op_bl(std::move(other.op_bl)),
+      op_ptr(std::move(other.op_ptr)),
+      on_applied(std::move(other.on_applied)),
+      on_commit(std::move(other.on_commit)),
+      on_applied_sync(std::move(other.on_applied_sync)) {
+      other.osr = nullptr;
+      other.use_tbl = false;
+      other.coll_id = 0;
+      other.object_id = 0;
+    }
+
+    Transaction& operator=(Transaction&& other) {
+      data = std::move(other.data);
+      osr = other.osr;
+      use_tbl = other.use_tbl;
+      tbl = std::move(other.tbl);
+      coll_index = std::move(other.coll_index);
+      object_index = std::move(other.object_index);
+      coll_id = other.coll_id;
+      object_id = other.object_id;
+      data_bl = std::move(other.data_bl);
+      op_bl = std::move(other.op_bl);
+      op_ptr = std::move(other.op_ptr);
+      on_applied = std::move(other.on_applied);
+      on_commit = std::move(other.on_commit);
+      on_applied_sync = std::move(other.on_applied_sync);
+      other.osr = nullptr;
+      other.use_tbl = false;
+      other.coll_id = 0;
+      other.object_id = 0;
+      return *this;
+    }
+
+    Transaction(const Transaction& other) = default;
+    Transaction& operator=(const Transaction& other) = default;
+
     /* Operations on callback contexts */
     void register_on_applied(Context *c) {
       if (!c) return;