]> 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)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 18 Jul 2014 21:55:58 +0000 (14:55 -0700)
Partially fixes #8858.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
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 052dd2559d54bd9673d12a868bb9fc68a9b505a7..22742c2d074dfcbe200274a902d209dc468d89c3 100644 (file)
@@ -1518,7 +1518,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 298df5064111219df5a1f8adcefe9eef805c1c30..4afe1ae10192a8bc5b4277adaa12aedb8b3ce9c0 100644 (file)
@@ -372,7 +372,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);
 
@@ -388,7 +388,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;
@@ -641,7 +641,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 56b498d6af0bf45e6d4a88896439f9e12aeaa276..714349f4f8df3e1a8e5cf8887b8ed5e57ac3a510 100644 (file)
@@ -706,7 +706,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)
@@ -1104,7 +1104,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 6b2cc8ce18618eddddc2279a3540c2c5d7d52adf..ea33bfbc784b86de50c14b8261ea4a668b1cbd1f 100644 (file)
@@ -2251,7 +2251,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)
 {
@@ -2318,6 +2319,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 ad29f2de815505b33e50b081ba37924ae21c195c..63c9ac73fdd36643c66418d49cb812c62b08efa2 100644 (file)
@@ -1440,8 +1440,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 7780b32427650293a1a0d867f17380984c201224..f6291a0ea7ef2b51ef0a891ce0870d0e0b08692f 100644 (file)
@@ -257,6 +257,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);