From d53c0591d4302748fc702cd8b8f1817c216bd0fd Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Sat, 8 Apr 2017 12:40:12 -0400 Subject: [PATCH] rgw: enable move on RGWRESTConn added custom move construct/assign because std::atomic is not movable Signed-off-by: Casey Bodley --- src/rgw/rgw_rest_conn.cc | 21 +++++++++++++++++++++ src/rgw/rgw_rest_conn.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index 3cda4d305d6f9..22534d8656dea 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -19,6 +19,27 @@ RGWRESTConn::RGWRESTConn(CephContext *_cct, RGWRados *store, } } +RGWRESTConn::RGWRESTConn(RGWRESTConn&& other) + : cct(other.cct), + endpoints(std::move(other.endpoints)), + key(std::move(other.key)), + self_zone_group(std::move(other.self_zone_group)), + remote_id(std::move(other.remote_id)), + counter(other.counter.load()) +{ +} + +RGWRESTConn& RGWRESTConn::operator=(RGWRESTConn&& other) +{ + cct = other.cct; + endpoints = std::move(other.endpoints); + key = std::move(other.key); + self_zone_group = std::move(other.self_zone_group); + remote_id = std::move(other.remote_id); + counter = other.counter.load(); + return *this; +} + int RGWRESTConn::get_url(string& endpoint) { if (endpoints.empty()) { diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h index 2b2cf700ac480..bec829d6939b5 100644 --- a/src/rgw/rgw_rest_conn.h +++ b/src/rgw/rgw_rest_conn.h @@ -61,6 +61,10 @@ class RGWRESTConn public: RGWRESTConn(CephContext *_cct, RGWRados *store, const string& _remote_id, const list& endpoints); + // custom move needed for atomic + RGWRESTConn(RGWRESTConn&& other); + RGWRESTConn& operator=(RGWRESTConn&& other); + int get_url(string& endpoint); string get_url(); const string& get_self_zonegroup() { -- 2.39.5