]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/onode-staged-tree: implement staged::is_keys_one()
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 7 Apr 2021 07:34:19 +0000 (15:34 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 29 Apr 2021 08:03:37 +0000 (16:03 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h

index e3897a9ce3bb04ade207d2c02fa5bc481178a2c9..d9be080201b20e4e9df71815b30dc937fa2b5957 100644 (file)
@@ -858,8 +858,20 @@ struct staged {
 
   static bool is_keys_one(
       const container_t& container) {      // IN
-    // TODO
-    ceph_abort("not implemented");
+    auto iter = iterator_t(container);
+    iter.seek_last();
+    if (iter.index() == 0) {
+      if constexpr (IS_BOTTOM) {
+        // ok, there is only 1 key
+        return true;
+      } else {
+        auto nxt_container = iter.get_nxt_container();
+        return NXT_STAGE_T::is_keys_one(nxt_container);
+      }
+    } else {
+      // more than 1 keys
+      return false;
+    }
   }
 
   template <bool GET_KEY>