]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: add RGWRados::bi_get_olh() to read/decode olh entry
authorCasey Bodley <cbodley@redhat.com>
Fri, 25 Jan 2019 21:43:36 +0000 (16:43 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 28 Jan 2019 20:19:43 +0000 (15:19 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 37cd1429d9a41e81046e7320e989afcda18800ac..f7c23987cc4f9f41b380671c8a82fd5124beefaa 100644 (file)
@@ -8695,6 +8695,28 @@ int RGWRados::bi_get_instance(const RGWBucketInfo& bucket_info, const rgw_obj& o
   return 0;
 }
 
+int RGWRados::bi_get_olh(const RGWBucketInfo& bucket_info, const rgw_obj& obj,
+                         rgw_bucket_olh_entry *olh)
+{
+  rgw_cls_bi_entry bi_entry;
+  int r = bi_get(bucket_info, obj, BIIndexType::OLH, &bi_entry);
+  if (r < 0 && r != -ENOENT) {
+    ldout(cct, 0) << "ERROR: bi_get() returned r=" << r << dendl;
+  }
+  if (r < 0) {
+    return r;
+  }
+  auto iter = bi_entry.data.cbegin();
+  try {
+    decode(*olh, iter);
+  } catch (buffer::error& err) {
+    ldout(cct, 0) << "ERROR: failed to decode bi_entry()" << dendl;
+    return -EIO;
+  }
+
+  return 0;
+}
+
 int RGWRados::bi_get(const RGWBucketInfo& bucket_info, const rgw_obj& obj,
                      BIIndexType index_type, rgw_cls_bi_entry *entry)
 {
index fadda11cc01aaa4667b771e49bfb6ca6335d583a..3fbb8489086553f8b6c73169fc8942a83b467ed0 100644 (file)
@@ -2220,6 +2220,7 @@ public:
   int get_bi_log_status(RGWBucketInfo& bucket_info, int shard_id, map<int, string>& max_marker);
 
   int bi_get_instance(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_bucket_dir_entry *dirent);
+  int bi_get_olh(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_bucket_olh_entry *olh);
   int bi_get(const RGWBucketInfo& bucket_info, const rgw_obj& obj, BIIndexType index_type, rgw_cls_bi_entry *entry);
   void bi_put(librados::ObjectWriteOperation& op, BucketShard& bs, rgw_cls_bi_entry& entry);
   int bi_put(BucketShard& bs, rgw_cls_bi_entry& entry);