]> 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>
Tue, 27 Sep 2016 22:31:28 +0000 (15:31 -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 49bb840c2f980bb92a3d8b123875617a3c5b88b3..338cc2587572aafa079ccab0ab39de736d2a7704 100644 (file)
@@ -257,6 +257,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 a3555e7944185904059bd2c6efe5f9760dc406b1..df35cce4e3d8f6d48a2bad766384445486e622aa 100644 (file)
@@ -320,6 +320,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 89c8476d71d29ac21e2d8afe17fd0803e4d5630c..dc0b6e291915e3dd9d3e1579d693840d146fc7ed 100644 (file)
@@ -232,6 +232,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 dfa9286c0008e2e970d68b498b0537e429b1d63f..78edcaadefd6895da7fa3c6b08e249bc3afe60f1 100644 (file)
@@ -375,6 +375,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)