From bade9a3ec3f7352d4857e7abb09c701b2ab30d9d Mon Sep 17 00:00:00 2001 From: Steve Atherton Date: Thu, 10 Mar 2022 00:07:22 -0800 Subject: [PATCH] Added toString() methods for DeltaTree::DecodeCache. --- fdbserver/DeltaTree.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fdbserver/DeltaTree.h b/fdbserver/DeltaTree.h index 9cd2e69b4c..746b96dc09 100644 --- a/fdbserver/DeltaTree.h +++ b/fdbserver/DeltaTree.h @@ -1077,7 +1077,7 @@ public: Node* node(DeltaTree2* tree) const { return tree->nodeAt(nodeOffset); } - std::string toString() { + std::string toString() const { return format("DecodedNode{nodeOffset=%d leftChildIndex=%d rightChildIndex=%d leftParentIndex=%d " "rightParentIndex=%d}", (int)nodeOffset, @@ -1154,6 +1154,19 @@ public: arena = a; updateUsedMemory(); } + + std::string toString() const { + std::string s = format("DecodeCache{%p\n", this); + s += format("upperBound %s\n", upperBound.toString().c_str()); + s += format("lowerBound %s\n", lowerBound.toString().c_str()); + s += format("arenaSize %d\n", arena.getSize()); + s += format("decodedNodes %d {\n", decodedNodes.size()); + for (auto const& n : decodedNodes) { + s += format(" %s\n", n.toString().c_str()); + } + s += format("}}\n"); + return s; + } }; // Cursor provides a way to seek into a DeltaTree and iterate over its contents