]> 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)
committerRobin H. Johnson <robin.johnson@dreamhost.com>
Thu, 9 Feb 2017 22:35:57 +0000 (14:35 -0800)
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>
(cherry picked from commit 9b3a2a40a5732689be98a940f7e6c3c4a6e73c53)
See: http://tracker.ceph.com/issues/17556
See: https://github.com/ceph/ceph/pull/11368
Signed-off-by: Robin H. Johnson <robin.johnson@dreamhost.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 1cf1156385bb22d35690ada8f76673fca2738a9f..220257499a1eb4291a9ed2576698c27384c851ba 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 1b02a5eabf4e6c786b3d764a54afec36792fd789..d691eb8bf5425264fe151573c379a29980f26b47 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 8409f1974c53df6704646ee05c83c1f3ae2c98f6..c31f84b84b5b53804dfb4e0ad61272110c9f7ab5 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)