Print clear-related metadata for printInOrder

This commit is contained in:
2024-05-01 17:18:02 -07:00
parent 9dbd9e028a
commit 791030dc3a

View File

@@ -491,8 +491,18 @@ struct VersionedMap::Impl {
}
printInOrderHelper(version,
child<std::memory_order_relaxed>(node, false, version));
printf("%.*s\n", (int)mm.base[node].entry->keyLen,
printf("%.*s", (int)mm.base[node].entry->keyLen,
mm.base[node].entry->getKey());
if (mm.base[node].entry->valLen >= 0) {
printf(" -> '%.*s'", (int)mm.base[node].entry->valLen,
mm.base[node].entry->getVal());
} else {
printf(" <cleared>");
}
if (mm.base[node].entry->clearTo) {
printf(" <clearTo>");
}
printf("\n");
printInOrderHelper(version,
child<std::memory_order_relaxed>(node, true, version));
}
@@ -509,7 +519,7 @@ int main() {
{
weaselab::VersionedMap::Impl impl;
impl.roots.add(impl.newNode(1, (const uint8_t *)"a", 1, nullptr, -1, false),
impl.roots.add(impl.newNode(1, (const uint8_t *)"a", 1, nullptr, 0, true),
1);
impl.roots.add(impl.newNode(2, (const uint8_t *)"b", 1, nullptr, -1, false),
2);