]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add NextMarker param for bucket listing
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 17 Jul 2014 18:24:51 +0000 (11:24 -0700)
committerSage Weil <sage@redhat.com>
Sun, 20 Jul 2014 03:51:32 +0000 (20:51 -0700)
Partially fixes #8858.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 924686f0b6593deffcd1d4e80ab06b1e7af00dcb)

src/rgw/rgw_admin.cc
src/rgw/rgw_bucket.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_rest_s3.cc

index ec83878037191e05955932607970f836ca1601d6..e31a28a676689f8865757a2fe63583230c7a7c12 100644 (file)
@@ -1495,7 +1495,7 @@ int main(int argc, char **argv)
       do {
         list<rgw_bi_log_entry> entries;
         ret = store->list_objects(bucket, max_entries - count, prefix, delim,
-                                  marker, result, common_prefixes, true,
+                                  marker, NULL, result, common_prefixes, true,
                                   ns, false, &truncated, NULL);
         if (ret < 0) {
           cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
index 9827bad309c9e3a195f698dab84ad5b09b68d861..3c4f66c9e089f56bd28249fdeb12a4d2e79af3e3 100644 (file)
@@ -368,7 +368,7 @@ int rgw_remove_bucket(RGWRados *store, const string& bucket_owner, rgw_bucket& b
 
   if (delete_children) {
     int max = 1000;
-    ret = store->list_objects(bucket, max, prefix, delim, marker,
+    ret = store->list_objects(bucket, max, prefix, delim, marker, NULL,
             objs, common_prefixes,
             false, ns, true, NULL, NULL);
 
@@ -384,7 +384,7 @@ int rgw_remove_bucket(RGWRados *store, const string& bucket_owner, rgw_bucket& b
       }
       objs.clear();
 
-      ret = store->list_objects(bucket, max, prefix, delim, marker, objs, common_prefixes,
+      ret = store->list_objects(bucket, max, prefix, delim, marker, NULL, objs, common_prefixes,
                                 false, ns, true, NULL, NULL);
       if (ret < 0)
         return ret;
@@ -630,7 +630,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
 
   do {
     vector<RGWObjEnt> result;
-    int r = store->list_objects(bucket, max, prefix, delim, marker,
+    int r = store->list_objects(bucket, max, prefix, delim, marker, NULL,
                                 result, common_prefixes, false,
                                 ns, true,
                                 &is_truncated, NULL);
index 7894927cfc2d997844f4451c54ea5761e590f67a..8979619293c3ac0ade5639918179962a9645140f 100644 (file)
@@ -704,7 +704,7 @@ static int iterate_user_manifest_parts(CephContext *cct, RGWRados *store, off_t
 
   do {
 #define MAX_LIST_OBJS 100
-    int r = store->list_objects(bucket, MAX_LIST_OBJS, obj_prefix, delim, marker,
+    int r = store->list_objects(bucket, MAX_LIST_OBJS, obj_prefix, delim, marker, NULL,
                                 objs, common_prefixes,
                                 true, no_ns, true, &is_truncated, NULL);
     if (r < 0)
@@ -1102,7 +1102,9 @@ void RGWListBucket::execute()
   if (ret < 0)
     return;
 
-  ret = store->list_objects(s->bucket, max, prefix, delimiter, marker, objs, common_prefixes,
+  string *pnext_marker = (delimiter.empty() ? NULL : &next_marker);
+
+  ret = store->list_objects(s->bucket, max, prefix, delimiter, marker, pnext_marker, objs, common_prefixes,
                                !!(s->prot_flags & RGW_REST_SWIFT), no_ns, true, &is_truncated, NULL);
 }
 
@@ -2993,7 +2995,7 @@ void RGWListBucketMultiparts::execute()
     }
   }
   marker_meta = marker.get_meta();
-  ret = store->list_objects(s->bucket, max_uploads, prefix, delimiter, marker_meta, objs, common_prefixes,
+  ret = store->list_objects(s->bucket, max_uploads, prefix, delimiter, marker_meta, NULL, objs, common_prefixes,
                                !!(s->prot_flags & RGW_REST_SWIFT), mp_ns, true, &is_truncated, &mp_filter);
   if (!objs.empty()) {
     vector<RGWObjEnt>::iterator iter;
index 95a34edc2b943d7d003b52bc8e91cf425283cd65..b141ed5bd1bcdfbb6f17e4c9ce4af38af20ca741 100644 (file)
@@ -202,6 +202,7 @@ class RGWListBucket : public RGWOp {
 protected:
   string prefix;
   string marker; 
+  string next_marker; 
   string max_keys;
   string delimiter;
   int max;
index cb84ab37fafe903441a7818a6683665fa797d635..a2600beeb76a674062abc8620b1ab3de3065d0c9 100644 (file)
@@ -2086,7 +2086,8 @@ int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset,
  *     here.
  */
 int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string& delim,
-                          string& marker, vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
+                          string& marker, string *next_marker, vector<RGWObjEnt>& result,
+                           map<string, bool>& common_prefixes,
                           bool get_content_type, string& ns, bool enforce_ns,
                            bool *is_truncated, RGWAccessListFilter *filter)
 {
@@ -2153,6 +2154,10 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string&
         continue;
       }
 
+      if (next_marker) {
+        *next_marker = obj;
+      }
+
       if (filter && !filter->filter(obj, key))
         continue;
 
index 5cc9c73407b9203d665c8979d741d7d656b9bc26..d50fb592edb95e08b8727b2a692bba9eed50b6e6 100644 (file)
@@ -1392,8 +1392,9 @@ public:
    *     here.
    */
   virtual int list_objects(rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
-                   std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
-                  bool get_content_type, string& ns, bool enforce_ns, bool *is_truncated, RGWAccessListFilter *filter);
+                   std::string& marker, std::string *next_marker, std::vector<RGWObjEnt>& result,
+                   map<string, bool>& common_prefixes, bool get_content_type, string& ns, bool enforce_ns,
+                   bool *is_truncated, RGWAccessListFilter *filter);
 
   virtual int create_pool(rgw_bucket& bucket);
 
index b28c2a947922525ee6ae30f667c18c6cd77c83f4..84499b0e43ec16ced7633621a76beef696fe7917 100644 (file)
@@ -254,6 +254,8 @@ void RGWListBucket_ObjStore_S3::send_response()
   if (!prefix.empty())
     s->formatter->dump_string("Prefix", prefix);
   s->formatter->dump_string("Marker", marker);
+  if (is_truncated && !next_marker.empty())
+    s->formatter->dump_string("NextMarker", next_marker);
   s->formatter->dump_int("MaxKeys", max);
   if (!delimiter.empty())
     s->formatter->dump_string("Delimiter", delimiter);