From: Casey Bodley Date: Thu, 21 Jan 2016 15:02:39 +0000 (-0500) Subject: os: add custom move ctor/assignment for Transaction X-Git-Tag: v10.0.4~177^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7303%2Fhead;p=ceph.git os: add custom move ctor/assignment for Transaction Signed-off-by: Casey Bodley --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index d85c87d2a099..5ba83bf373a4 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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;