]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use prefix filter for bucket listing
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 8 Mar 2012 01:10:18 +0000 (17:10 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 8 Mar 2012 01:10:18 +0000 (17:10 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index bdc7b6e1f50c78ee00e929f445a81c0a5babf2ed..c83892072fddd3a69b4987b8e106add41197f53a 100644 (file)
@@ -362,7 +362,7 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string&
         r = pool_list(bucket, cur_marker, max - count, ent_map,
                       &truncated, &cur_marker);
     } else {
-        r = cls_bucket_list(bucket, cur_marker, max - count, ent_map,
+        r = cls_bucket_list(bucket, cur_marker, prefix, max - count, ent_map,
                             &truncated, &cur_marker);
     }
     if (r < 0)
@@ -898,12 +898,12 @@ int RGWRados::delete_bucket(rgw_bucket& bucket)
     return r;
 
   std::map<string, RGWObjEnt> ent_map;
-  string marker;
+  string marker, prefix;
   bool is_truncated;
 
   do {
 #define NUM_ENTRIES 1000
-    r = cls_bucket_list(bucket, marker, NUM_ENTRIES, ent_map,
+    r = cls_bucket_list(bucket, marker, prefix, NUM_ENTRIES, ent_map,
                         &is_truncated, &marker);
     if (r < 0)
       return r;
@@ -2213,7 +2213,8 @@ int RGWRados::cls_obj_complete_del(rgw_bucket& bucket, string& tag, uint64_t epo
   return cls_obj_complete_op(bucket, CLS_RGW_OP_DEL, tag, epoch, ent, RGW_OBJ_CATEGORY_NONE);
 }
 
-int RGWRados::cls_bucket_list(rgw_bucket& bucket, string start, uint32_t num, map<string, RGWObjEnt>& m,
+int RGWRados::cls_bucket_list(rgw_bucket& bucket, string start, string prefix,
+                             uint32_t num, map<string, RGWObjEnt>& m,
                              bool *is_truncated, string *last_entry)
 {
   dout(10) << "cls_bucket_list " << bucket << " start " << start << " num " << num << dendl;
@@ -2234,6 +2235,7 @@ int RGWRados::cls_bucket_list(rgw_bucket& bucket, string start, uint32_t num, ma
   bufferlist in, out;
   struct rgw_cls_list_op call;
   call.start_obj = start;
+  call.filter_prefix = prefix;
   call.num_entries = num;
   ::encode(call, in);
   r = io_ctx.exec(oid, "rgw", "bucket_list", in, out);
index d95025bc412d139304c082a1c1c1bda2b20ffc1d..33071fe788273249d5a819c9b4bf0656520ace80 100644 (file)
@@ -337,7 +337,7 @@ public:
                           RGWObjEnt& ent, RGWObjCategory category);
   int cls_obj_complete_add(rgw_bucket& bucket, string& tag, uint64_t epoch, RGWObjEnt& ent, RGWObjCategory category);
   int cls_obj_complete_del(rgw_bucket& bucket, string& tag, uint64_t epoch, string& name);
-  int cls_bucket_list(rgw_bucket& bucket, string start, uint32_t num,
+  int cls_bucket_list(rgw_bucket& bucket, string start, string prefix, uint32_t num,
                       map<string, RGWObjEnt>& m, bool *is_truncated,
                       string *last_entry = NULL);
   int cls_bucket_head(rgw_bucket& bucket, struct rgw_bucket_dir_header& header);