*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());
}
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());
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()
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()
);
}
+ /**
+ * 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);
}
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) {
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));