refactor(extmarks): some minor internal API changes

extranges and a bunch of other improvements are coming for 0.10
This gets in some minor surrounding API changes to avoid rebase
conflicts until then.

- decorations will be able to be specific to windows
- adjust deletion API to fit with extranges
This commit is contained in:
bfredl
2023-03-16 13:56:05 +01:00
parent 320cb344c1
commit 8021300806
9 changed files with 53 additions and 40 deletions

View File

@@ -279,13 +279,13 @@ void marktree_put_key(MarkTree *b, mtkey_t k)
/// 6. If 4 went all the way to the root node. The root node
/// might have ended up with size 0. Delete it then.
///
/// NB: ideally keeps the iterator valid. Like point to the key after this
/// if present.
/// The iterator remains valid, and now points at the key _after_ the deleted
/// one.
///
/// @param rev should be true if we plan to iterate _backwards_ and delete
/// stuff before this key. Most of the time this is false (the
/// recommended strategy is to always iterate forward)
void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
uint64_t marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
{
int adjustment = 0;
@@ -294,6 +294,12 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
uint64_t id = mt_lookup_key(cur->key[curi]);
// fprintf(stderr, "\nDELET %lu\n", id);
mtkey_t raw = rawkey(itr);
uint64_t other = 0;
if (mt_paired(raw)) {
other = mt_lookup_id(raw.ns, raw.id, !mt_end(raw));
}
if (itr->node->level) {
if (rev) {
abort();
@@ -442,6 +448,8 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
marktree_itr_next(b, itr);
}
}
return other;
}
static mtnode_t *merge_node(MarkTree *b, mtnode_t *p, int i)