]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: move shard marker helper into BucketIndexShardsManager
authorCasey Bodley <cbodley@redhat.com>
Tue, 24 Oct 2017 15:08:24 +0000 (11:08 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 10 Nov 2017 18:23:03 +0000 (13:23 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/cls/rgw/cls_rgw_client.h
src/rgw/rgw_cr_rados.cc

index 6b399890793d86f1db081a70447f1de5b35bb0d5..e33dfe668d9cb7aa58ae92fc9308d0ba2e6a50e9 100644 (file)
@@ -218,6 +218,15 @@ public:
     }
     return 0;
   }
+
+  // trim the '<shard-id>#' prefix from a single shard marker if present
+  static std::string get_shard_marker(const std::string& marker) {
+    auto p = marker.find(KEY_VALUE_SEPARATOR);
+    if (p == marker.npos) {
+      return marker;
+    }
+    return marker.substr(p + 1);
+  }
 };
 
 /* bucket index */
index 06de89a8a20b3b09a90b3906e374337b9e323677..edffa8061180c32092a940e9ae79c6d1b4d73f04 100644 (file)
@@ -492,25 +492,14 @@ int RGWAsyncGetBucketInstanceInfo::_send_request()
   return 0;
 }
 
-static std::string normalize_shard_marker(const std::string& marker)
-{
-  // markers may be formatted with '<shard-id>#' at the beginning.
-  // CLSRGWIssueBILogTrim would fix this for us, but it's synchronous
-  auto p = marker.find(BucketIndexShardsManager::KEY_VALUE_SEPARATOR);
-  if (p == marker.npos) {
-    return marker;
-  }
-  return marker.substr(p + 1);
-}
-
 RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(RGWRados *store,
                                          const RGWBucketInfo& bucket_info,
                                          int shard_id,
                                          const std::string& start_marker,
                                          const std::string& end_marker)
   : RGWSimpleCoroutine(store->ctx()), bs(store),
-    start_marker(normalize_shard_marker(start_marker)),
-    end_marker(normalize_shard_marker(end_marker))
+    start_marker(BucketIndexShardsManager::get_shard_marker(start_marker)),
+    end_marker(BucketIndexShardsManager::get_shard_marker(end_marker))
 {
   bs.init(bucket_info, shard_id);
 }