Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nomt/src/beatree/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ impl Index {
self.first_key_map.get_prev(&key).map(|(sep, b)| (sep.clone(), b.clone()))
}

/// Get the first branch with separator greater than the given key.
pub fn next_after(&self, key: Key) -> Option<(Key, Arc<BranchNode>)> {
/// Get the first separator greater than the given key.
pub fn next_key(&self, key: Key) -> Option<Key> {
self.first_key_map
.range(RangeFromExclusive { start: key })
.next()
.map(|(k, b)| (*k, b.clone()))
.map(|(k, _)| *k)
}

/// Remove the branch with the given separator key.
Expand Down
2 changes: 1 addition & 1 deletion nomt/src/beatree/ops/update/branch_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ fn reset_branch_base_fresh(
return;
};

let cutoff = bbn_index.next_after(key).map(|(k, _)| k);
let cutoff = bbn_index.next_key(key);

branches_tracker.delete(separator, branch.bbn_pn().into(), cutoff);

Expand Down
2 changes: 1 addition & 1 deletion nomt/src/beatree/ops/update/leaf_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn indexed_leaf(bbn_index: &Index, key: Key) -> Option<(Key, Option<Key>, PageNu
let cutoff = if i + 1 < branch.n() as usize {
Some(get_key(&branch, i + 1))
} else {
bbn_index.next_after(key).map(|(cutoff, _)| cutoff)
bbn_index.next_key(key)
};

Some((separator, cutoff, leaf_pn))
Expand Down