From e0dc5a86cb582c5b514842b21acea657c074aea3 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 8 Nov 2018 12:43:21 -0800 Subject: [PATCH] librados_test_stub: implement move operations Need to match whatever librados implements. Signed-off-by: Yehuda Sadeh --- src/test/librados_test_stub/LibradosTestStub.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index 17221b24c30aa..4ad154bd1dcc5 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -367,6 +367,10 @@ IoCtx::IoCtx(const IoCtx& rhs) { } } +IoCtx::IoCtx(IoCtx&& rhs) noexcept : io_ctx_impl(std::exchange(rhs.io_ctx_impl, nullptr)) +{ +} + IoCtx& IoCtx::operator=(const IoCtx& rhs) { if (io_ctx_impl) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); @@ -381,6 +385,17 @@ IoCtx& IoCtx::operator=(const IoCtx& rhs) { return *this; } +librados::IoCtx& librados::IoCtx::operator=(IoCtx&& rhs) noexcept +{ + if (io_ctx_impl) { + TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); + ctx->put(); + } + + io_ctx_impl = std::exchange(rhs.io_ctx_impl, nullptr); + return *this; +} + int IoCtx::aio_flush() { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); ctx->aio_flush(); -- 2.39.5