]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw: utilities to support raw bucket index operations
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 26 Sep 2016 23:01:39 +0000 (16:01 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 19 Oct 2016 15:40:44 +0000 (08:40 -0700)
New flavour of bi_put() call, and a function to extract key off
a raw bi entry.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw_client.cc
src/cls/rgw/cls_rgw_client.h
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h

index f2dc02148bf5de63bfaf2388efa3c2deb0f3b449..c91a20c24cee2180f3cc1990714085e3ffadc434 100644 (file)
@@ -277,6 +277,15 @@ int cls_rgw_bi_put(librados::IoCtx& io_ctx, const string oid, rgw_cls_bi_entry&
   return 0;
 }
 
+void cls_rgw_bi_put(ObjectWriteOperation& op, const string oid, rgw_cls_bi_entry& entry)
+{
+  bufferlist in, out;
+  struct rgw_cls_bi_put_op call;
+  call.entry = entry;
+  ::encode(call, in);
+  op.exec("rgw", "bi_put", in);
+}
+
 int cls_rgw_bi_list(librados::IoCtx& io_ctx, const string oid,
                    const string& name, const string& marker, uint32_t max,
                    list<rgw_cls_bi_entry> *entries, bool *is_truncated)
index 4c68385f5a8ff503782d8a4a61d8e6285b96ab0b..22642c52c0a60e8cde2303cb98d480039d4fa39c 100644 (file)
@@ -324,6 +324,7 @@ int cls_rgw_bi_get(librados::IoCtx& io_ctx, const string oid,
                    BIIndexType index_type, cls_rgw_obj_key& key,
                    rgw_cls_bi_entry *entry);
 int cls_rgw_bi_put(librados::IoCtx& io_ctx, const string oid, rgw_cls_bi_entry& entry);
+void cls_rgw_bi_put(librados::ObjectWriteOperation& op, const string oid, rgw_cls_bi_entry& entry);
 int cls_rgw_bi_list(librados::IoCtx& io_ctx, const string oid,
                    const string& name, const string& marker, uint32_t max,
                    list<rgw_cls_bi_entry> *entries, bool *is_truncated);
index 79a52722d669bdd5cab1741784c121e2113112a3..428dd11fbf97364b3f63757facda74a53c0de3ff 100644 (file)
@@ -237,6 +237,30 @@ void rgw_cls_bi_entry::dump(Formatter *f) const
   dump_bi_entry(data, type, f);
 }
 
+void rgw_cls_bi_entry::get_key(cls_rgw_obj_key *key)
+{
+  bufferlist::iterator iter = data.begin();
+  switch (type) {
+    case PlainIdx:
+    case InstanceIdx:
+      {
+        rgw_bucket_dir_entry entry;
+        ::decode(entry, iter);
+        *key = entry.key;
+      }
+      break;
+    case OLHIdx:
+      {
+        rgw_bucket_olh_entry entry;
+        ::decode(entry, iter);
+        *key = entry.key;
+      }
+      break;
+    default:
+      break;
+  }
+}
+
 void rgw_bucket_olh_entry::dump(Formatter *f) const
 {
   encode_json("key", key, f);
index 33d273ac3ea2f8be14b643b38c9a6f6267bbd9e4..04383147e2412f9849449444eb5c7c9864362ed2 100644 (file)
@@ -388,6 +388,8 @@ struct rgw_cls_bi_entry {
 
   void dump(Formatter *f) const;
   void decode_json(JSONObj *obj, cls_rgw_obj_key *effective_key = NULL);
+
+  void get_key(cls_rgw_obj_key *key);
 };
 WRITE_CLASS_ENCODER(rgw_cls_bi_entry)