From an external caller, the condition is identical. However, internally
iterators may be at a leaf boundary without being at end(). For those
checks, use at_boundary() instead.
Signed-off-by: Samuel Just <sjust@redhat.com>
return find_insertion(
c, laddr, ret
).si_then([this, c, laddr, val, &ret] {
- if (!ret.is_end() && ret.get_key() == laddr) {
+ if (!ret.at_boundary() && ret.get_key() == laddr) {
return insert_ret(
interruptible::ready_future_marker{},
std::make_pair(ret, false));
// invariant that pos is a valid index for the node in the event
// that the insertion point is at the end of a node.
p.leaf.pos++;
- assert(p.is_end());
+ assert(p.at_boundary());
iter = p;
return seastar::now();
});
}
bool is_end() const {
- assert(leaf.pos <= leaf.node->get_size());
- return leaf.pos == leaf.node->get_size();
+ // external methods may only resolve at a boundary if at end
+ return at_boundary();
}
bool is_begin() const {
node_position_t<LBAInternalNode>, MAX_DEPTH> internal;
node_position_t<LBALeafNode> leaf;
+ bool at_boundary() const {
+ assert(leaf.pos <= leaf.node->get_size());
+ return leaf.pos == leaf.node->get_size();
+ }
+
depth_t check_split() const {
if (!leaf.node->at_max_capacity()) {
return 0;