Remove old implementation

This commit is contained in:
2024-01-24 13:06:46 -08:00
parent aa464573e4
commit af71519526

View File

@@ -1019,57 +1019,6 @@ Node *nextLogical(Node *node) {
return node;
}
std::string printable(std::string_view key) {
std::string result;
for (uint8_t c : key) {
result += "x";
result += "0123456789abcdef"[c / 16];
result += "0123456789abcdef"[c % 16];
}
return result;
}
std::string printable(const Key &key) {
return printable(std::string_view((const char *)key.p, key.len));
}
std::string_view getSearchPath(Arena &arena, Node *n) {
if (n->parent == nullptr) {
return {};
}
auto result = vector<char>(arena);
for (; n->parent != nullptr; n = n->parent) {
result.push_back(n->parentsIndex);
}
std::reverse(result.begin(), result.end());
return std::string_view((const char *)&result[0], result.size()); // NOLINT
}
void printLogical(std::string &result, Node *node) {
Arena arena;
for (Node *iter = node; iter != nullptr;) {
auto *next = nextLogical(iter);
std::string key;
for (uint8_t c : getSearchPath(arena, iter)) {
key += "x";
key += "0123456789abcdef"[c / 16];
key += "0123456789abcdef"[c % 16];
}
if (iter->entry.pointVersion == iter->entry.rangeVersion) {
result += key + " -> " + std::to_string(iter->entry.pointVersion) + "\n";
} else {
result += key + " -> " + std::to_string(iter->entry.pointVersion) + "\n";
if (next == nullptr || (getSearchPath(arena, next) !=
(std::string(getSearchPath(arena, iter)) +
std::string("\x00", 1)))) {
result +=
key + "x00 -> " + std::to_string(iter->entry.rangeVersion) + "\n";
}
}
iter = next;
}
}
Node *prevPhysical(Node *node) {
assert(node->parent != nullptr);
auto prevChild = getChildLeq(node->parent, node->parentsIndex - 1);