]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd/pg_backend: generalize PGBackend::list_objects, add overloads
authorSamuel Just <sjust@redhat.com>
Tue, 26 Mar 2024 05:13:40 +0000 (22:13 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 27 Mar 2024 02:36:54 +0000 (02:36 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h

index 8589980c4845eddefd8b3c4cf7a1db10d53457f8..bcdf2a6b1782f7ed18c4cd534dc35945aa3032a2 100644 (file)
@@ -1080,12 +1080,14 @@ PGBackend::remove(ObjectState& os, ceph::os::Transaction& txn,
 }
 
 PGBackend::interruptible_future<std::tuple<std::vector<hobject_t>, hobject_t>>
-PGBackend::list_objects(const hobject_t& start, uint64_t limit) const
+PGBackend::list_objects(
+  const hobject_t& start, const hobject_t &end, uint64_t limit) const
 {
   auto gstart = start.is_min() ? ghobject_t{} : ghobject_t{start, 0, shard};
+  auto gend = end.is_max() ? ghobject_t::get_max() : ghobject_t{end, 0, shard};
   return interruptor::make_interruptible(store->list_objects(coll,
                                         gstart,
-                                        ghobject_t::get_max(),
+                                        gend,
                                         limit))
     .then_interruptible([](auto ret) {
       auto& [gobjects, next] = ret;
index f3f27fd05ba0c6e926bcb87d4941198cd1e235b6..6d1a1271a44cc3300fc703dd7583c762ce10a81b 100644 (file)
@@ -228,9 +228,42 @@ public:
     epoch_t min_epoch,
     epoch_t map_epoch,
     std::vector<pg_log_entry_t>&& log_entries);
+
+  /**
+   * list_objects
+   *
+   * List a prefix of length up to limit of the ordered set of logical
+   * librados objects in [start, end) stored by the PG.
+   *
+   * Output excludes objects maintained locally on each pg instance such as:
+   * - pg_meta object (see hobject_t::is_pgmeta, ghobject_t::make_pgmeta)
+   * - snap mapper
+   * as well as
+   * - temp objects (see hobject_t::is_temp(), hobject_t::make_temp_hobject())
+   * - ec rollback objects (see ghobject_t::is_no_gen)
+   *
+   * @param [in] start inclusive beginning of range
+   * @param [in] end exclusive end of range
+   * @param [in] limit upper bound on number of objects to return
+   * @return pair<object_list, next> where object_list is the output list
+   *         above and next is > the elements in object_list and <= the
+   *         least eligible object in the pg > the elements in object_list
+   */
   interruptible_future<std::tuple<std::vector<hobject_t>, hobject_t>> list_objects(
     const hobject_t& start,
+    const hobject_t& end,
     uint64_t limit) const;
+  interruptible_future<std::tuple<std::vector<hobject_t>, hobject_t>> list_objects(
+    const hobject_t& start,
+    uint64_t limit) const {
+    return list_objects(start, hobject_t::get_max(), limit);
+  }
+  interruptible_future<std::tuple<std::vector<hobject_t>, hobject_t>> list_objects(
+    const hobject_t& start,
+    const hobject_t& end) {
+    return list_objects(start, end, std::numeric_limits<uint64_t>::max());
+  }
+
   using setxattr_errorator = crimson::errorator<
     crimson::ct_error::file_too_large,
     crimson::ct_error::enametoolong>;