]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/crimson/os/seastore/onode_manager/staged-fltree/tree.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / crimson / os / seastore / onode_manager / staged-fltree / tree.h
index 8c13f4fe1bc456c6e63e55c02c557eee76ab6ab6..7385e080c8f63a3df012e05e34fd08337a22f30c 100644 (file)
@@ -95,12 +95,7 @@ class Btree {
           *p_tree->nm, p_tree->value_builder, p_cursor);
     }
 
-    bool operator>(const Cursor& o) const { return (int)compare_to(o) > 0; }
-    bool operator>=(const Cursor& o) const { return (int)compare_to(o) >= 0; }
-    bool operator<(const Cursor& o) const { return (int)compare_to(o) < 0; }
-    bool operator<=(const Cursor& o) const { return (int)compare_to(o) <= 0; }
-    bool operator==(const Cursor& o) const { return (int)compare_to(o) == 0; }
-    bool operator!=(const Cursor& o) const { return (int)compare_to(o) != 0; }
+    bool operator==(const Cursor& o) const { return operator<=>(o) == 0; }
 
     eagain_ifuture<Cursor> get_next(Transaction& t) {
       assert(!is_end());
@@ -146,7 +141,7 @@ class Btree {
     }
     Cursor(Btree* p_tree) : p_tree{p_tree} {}
 
-    MatchKindCMP compare_to(const Cursor& o) const {
+    std::strong_ordering operator<=>(const Cursor& o) const {
       assert(p_tree == o.p_tree);
       return p_cursor->compare_to(
           *o.p_cursor, p_tree->value_builder.get_header_magic());
@@ -188,7 +183,7 @@ class Btree {
 
   eagain_ifuture<bool> contains(Transaction& t, const ghobject_t& obj) {
     return seastar::do_with(
-      full_key_t<KeyT::HOBJ>(obj),
+      key_hobj_t{obj},
       [this, &t](auto& key) -> eagain_ifuture<bool> {
         return get_root(t).si_then([this, &t, &key](auto root) {
           // TODO: improve lower_bound()
@@ -202,7 +197,7 @@ class Btree {
 
   eagain_ifuture<Cursor> find(Transaction& t, const ghobject_t& obj) {
     return seastar::do_with(
-      full_key_t<KeyT::HOBJ>(obj),
+      key_hobj_t{obj},
       [this, &t](auto& key) -> eagain_ifuture<Cursor> {
         return get_root(t).si_then([this, &t, &key](auto root) {
           // TODO: improve lower_bound()
@@ -218,9 +213,16 @@ 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),
+      key_hobj_t{obj},
       [this, &t](auto& key) -> eagain_ifuture<Cursor> {
         return get_root(t).si_then([this, &t, &key](auto root) {
           return root->lower_bound(get_context(t), key);
@@ -264,7 +266,7 @@ class Btree {
     }
     value_config_t vconf{value_builder.get_header_magic(), _vconf.payload_size};
     return seastar::do_with(
-      full_key_t<KeyT::HOBJ>(obj),
+      key_hobj_t{obj},
       [this, &t, vconf](auto& key) -> eagain_ifuture<std::pair<Cursor, bool>> {
         ceph_assert(key.is_valid());
         return get_root(t).si_then([this, &t, &key, vconf](auto root) {
@@ -279,7 +281,7 @@ class Btree {
 
   eagain_ifuture<std::size_t> erase(Transaction& t, const ghobject_t& obj) {
     return seastar::do_with(
-      full_key_t<KeyT::HOBJ>(obj),
+      key_hobj_t{obj},
       [this, &t](auto& key) -> eagain_ifuture<std::size_t> {
         return get_root(t).si_then([this, &t, &key](auto root) {
           return root->erase(get_context(t), key, std::move(root));