Changed rbyd removes to remove from the tree, similar to deletes

Tag removal is basically a range-delete of one that doesn't change
the tree weights. This deduplicates the two methods of deleting tags and
completely gets rid of tombstoning.

Note we still need a "removed tag" encoding so that we can invalidate
tags that may be found during fetch operations. Fortunately this
encoding is basically free due to overlap with alt encoding.
This commit is contained in:
Christopher Haster
2023-01-04 21:53:50 -06:00
parent 92ce5df949
commit 179a1df3d3
2 changed files with 105 additions and 64 deletions
+23 -23
View File
@@ -1876,29 +1876,29 @@ code = '''
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 3, 0), &off, &size)
=> LFS_ERR_NOENT;
// commit with two attributes, remove the second one
rbyd = init_rbyd;
lfs_bd_erase(&lfs, rbyd.block) => 0;
lfs_rbyd_commit(&lfs, &rbyd,
LFS_MKRATTR(UATTR, 1, 0, "\xaa\xaa\xaa\xaa", 4,
LFS_MKRATTR(UATTR, 2, 0, "\xbb\xbb\xbb\xbb", 4, NULL))) => 0;
lfs_rbyd_commit(&lfs, &rbyd,
LFS_MKRRMATTR(UATTR, 2, 0, NULL)) => 0;
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 1, 0), &off, &size)
=> LFS_MKRTAG(UATTR, 1, 0);
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 2, 0), &off, &size)
=> LFS_ERR_NOENT;
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 3, 0), &off, &size)
=> LFS_ERR_NOENT;
lfs_rbyd_fetch(&lfs, &rbyd, rbyd.block, NULL) => 0;
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 1, 0), &off, &size)
=> LFS_MKRTAG(UATTR, 1, 0);
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 2, 0), &off, &size)
=> LFS_ERR_NOENT;
lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 3, 0), &off, &size)
=> LFS_ERR_NOENT;
// // commit with two attributes, remove the second one
// rbyd = init_rbyd;
// lfs_bd_erase(&lfs, rbyd.block) => 0;
// lfs_rbyd_commit(&lfs, &rbyd,
// LFS_MKRATTR(UATTR, 1, 0, "\xaa\xaa\xaa\xaa", 4,
// LFS_MKRATTR(UATTR, 2, 0, "\xbb\xbb\xbb\xbb", 4, NULL))) => 0;
// lfs_rbyd_commit(&lfs, &rbyd,
// LFS_MKRRMATTR(UATTR, 2, 0, NULL)) => 0;
//
// lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 1, 0), &off, &size)
// => LFS_MKRTAG(UATTR, 1, 0);
// lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 2, 0), &off, &size)
// => LFS_ERR_NOENT;
// lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 3, 0), &off, &size)
// => LFS_ERR_NOENT;
//
// lfs_rbyd_fetch(&lfs, &rbyd, rbyd.block, NULL) => 0;
// lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 1, 0), &off, &size)
// => LFS_MKRTAG(UATTR, 1, 0);
// lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 2, 0), &off, &size)
// => LFS_ERR_NOENT;
// lfs_rbyd_lookup(&lfs, &rbyd, LFS_MKRTAG(UATTR, 3, 0), &off, &size)
// => LFS_ERR_NOENT;
'''
[cases.test_rbyd_remove_permutations]