]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/onode-staged-tree: expose compare method for ghobject_t 46922/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 1 Jul 2022 08:26:44 +0000 (16:26 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 1 Jul 2022 08:38:32 +0000 (16:38 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/tree.h

index 8c13f4fe1bc456c6e63e55c02c557eee76ab6ab6..bffc9b8945ca1e49d8854df020b77a81270e8f84 100644 (file)
@@ -47,6 +47,15 @@ class Btree {
   Btree& operator=(const Btree&) = delete;
   Btree& operator=(Btree&&) = delete;
 
+  /**
+   * compare
+   *
+   * This defines the internal order of Btree from ghobject_t perspective.
+   */
+  static int compare(const ghobject_t &l, const ghobject_t &r) {
+    return static_cast<int>(key_hobj_t(l).compare_to(key_hobj_t(r)));
+  }
+
   eagain_ifuture<> mkfs(Transaction& t) {
     return Node::mkfs(get_context(t), *root_tracker);
   }
@@ -218,6 +227,13 @@ class Btree {
     );
   }
 
+  /**
+   * lower_bound
+   *
+   * Returns a Cursor pointing to the element that is equal to the key, or the
+   * first element larger than the key, or the end Cursor if that element
+   * doesn't exist.
+   */
   eagain_ifuture<Cursor> lower_bound(Transaction& t, const ghobject_t& obj) {
     return seastar::do_with(
       full_key_t<KeyT::HOBJ>(obj),