]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rgw: add client api calls for index suggest
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 12 Sep 2012 18:10:57 +0000 (11:10 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 18 Sep 2012 19:27:43 +0000 (12:27 -0700)
This is needed for unitest creation.

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

index 29cf389431b0966361740715eafddc643a593c37..1e7c7d01c39c3d951ce3d55d19997deb8ebb15f5 100644 (file)
@@ -66,6 +66,17 @@ int cls_rgw_list_op(IoCtx& io_ctx, string& oid, string& start_obj,
  return r;
 }
 
+void cls_rgw_encode_suggestion(char op, rgw_bucket_dir_entry& dirent, bufferlist& updates)
+{
+  updates.append(op);
+  ::encode(dirent, updates);
+}
+
+void cls_rgw_suggest_changes(ObjectWriteOperation& o, bufferlist& updates)
+{
+  o.exec("rgw", "dir_suggest_changes", updates);
+}
+
 int cls_rgw_get_dir_header(IoCtx& io_ctx, string& oid, rgw_bucket_dir_header *header)
 {
   bufferlist in, out;
index 50b8125e8b13ebdef4e73cd54051db8a80dd5d9e..fec37da53ed4c79fa42d94866e93cb08c2587703 100644 (file)
@@ -18,6 +18,10 @@ int cls_rgw_list_op(librados::IoCtx& io_ctx, string& oid, string& start_obj,
 
 int cls_rgw_get_dir_header(librados::IoCtx& io_ctx, string& oid, rgw_bucket_dir_header *header);
 
+void cls_rgw_encode_suggestion(char op, rgw_bucket_dir_entry& dirent, bufferlist& updates);
+
+void cls_rgw_suggest_changes(librados::ObjectWriteOperation& o, bufferlist& updates);
+
 /* usage logging */
 int cls_rgw_usage_log_read(librados::IoCtx& io_ctx, string& oid, string& user,
                            uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
index 2b6d4715052047161fecc9a577e30b1147ca62d6..3864bdd07f2d451c737aa7d48c89b69543dc3fbb 100644 (file)
@@ -2866,9 +2866,11 @@ int RGWRados::cls_bucket_list(rgw_bucket& bucket, string start, string prefix,
   }
 
   if (updates.length()) {
+    ObjectWriteOperation o;
+    cls_rgw_suggest_changes(o, updates);
     // we don't care if we lose suggested updates, send them off blindly
     AioCompletion *c = librados::Rados::aio_create_completion(NULL, NULL, NULL);
-    r = io_ctx.aio_exec(oid, c, "rgw", "dir_suggest_changes", updates, NULL);
+    r = io_ctx.aio_operate(oid, c, &o);
     c->release();
   }
   return m.size();
@@ -2961,8 +2963,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
     }
     // encode a suggested removal of that key
     list_state.epoch = io_ctx.get_last_version();
-    suggested_updates.append(CEPH_RGW_REMOVE);
-    ::encode(list_state, suggested_updates);
+    cls_rgw_encode_suggestion(CEPH_RGW_REMOVE, list_state, suggested_updates);
   }
   if (r < 0)
     return r;
@@ -2971,8 +2972,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
   list_state.epoch = io_ctx.get_last_version();
   list_state.meta.size = object.size;
   list_state.meta.mtime.set_from_double(double(object.mtime));
-  suggested_updates.append(CEPH_RGW_UPDATE);
-  ::encode(list_state, suggested_updates);
+  cls_rgw_encode_suggestion(CEPH_RGW_UPDATE, list_state, suggested_updates);
   return 0;
 }