crimson/onode-staged-tree: implement staged::is_keys_one()

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
This commit is contained in:
Yingxin Cheng 2021-04-07 15:34:19 +08:00
parent eb4c03f4ef
commit c4b5e7fecd

View 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>