Track counts of SHAMap-related objects

This commit is contained in:
Nik Bougalis
2020-10-17 14:58:04 -07:00
parent f072469409
commit 5def79e93c
3 changed files with 9 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
#define RIPPLE_SHAMAP_SHAMAPITEM_H_INCLUDED #define RIPPLE_SHAMAP_SHAMAPITEM_H_INCLUDED
#include <ripple/basics/Blob.h> #include <ripple/basics/Blob.h>
#include <ripple/basics/CountedObject.h>
#include <ripple/basics/Slice.h> #include <ripple/basics/Slice.h>
#include <ripple/basics/base_uint.h> #include <ripple/basics/base_uint.h>
#include <ripple/beast/utility/Journal.h> #include <ripple/beast/utility/Journal.h>
@@ -31,7 +32,7 @@
namespace ripple { namespace ripple {
// an item stored in a SHAMap // an item stored in a SHAMap
class SHAMapItem class SHAMapItem : public CountedObject<SHAMapItem>
{ {
private: private:
uint256 tag_; uint256 tag_;

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_SHAMAP_SHAMAPNODEID_H_INCLUDED #ifndef RIPPLE_SHAMAP_SHAMAPNODEID_H_INCLUDED
#define RIPPLE_SHAMAP_SHAMAPNODEID_H_INCLUDED #define RIPPLE_SHAMAP_SHAMAPNODEID_H_INCLUDED
#include <ripple/basics/CountedObject.h>
#include <ripple/basics/base_uint.h> #include <ripple/basics/base_uint.h>
#include <optional> #include <optional>
#include <ostream> #include <ostream>
@@ -29,7 +30,7 @@
namespace ripple { namespace ripple {
/** Identifies a node inside a SHAMap */ /** Identifies a node inside a SHAMap */
class SHAMapNodeID class SHAMapNodeID : public CountedObject<SHAMapNodeID>
{ {
private: private:
uint256 id_; uint256 id_;

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED #ifndef RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED
#define RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED #define RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED
#include <ripple/basics/CountedObject.h>
#include <ripple/basics/TaggedCache.h> #include <ripple/basics/TaggedCache.h>
#include <ripple/beast/utility/Journal.h> #include <ripple/beast/utility/Journal.h>
#include <ripple/shamap/SHAMapItem.h> #include <ripple/shamap/SHAMapItem.h>
@@ -202,7 +203,8 @@ private:
bool hashValid); bool hashValid);
}; };
class SHAMapInnerNode : public SHAMapAbstractNode class SHAMapInnerNode : public SHAMapAbstractNode,
public CountedObject<SHAMapInnerNode>
{ {
std::array<SHAMapHash, 16> mHashes; std::array<SHAMapHash, 16> mHashes;
std::shared_ptr<SHAMapAbstractNode> mChildren[16]; std::shared_ptr<SHAMapAbstractNode> mChildren[16];
@@ -273,7 +275,8 @@ public:
// SHAMapTreeNode represents a leaf, and may eventually be renamed to reflect // SHAMapTreeNode represents a leaf, and may eventually be renamed to reflect
// that. // that.
class SHAMapTreeNode : public SHAMapAbstractNode class SHAMapTreeNode : public SHAMapAbstractNode,
public CountedObject<SHAMapTreeNode>
{ {
private: private:
std::shared_ptr<SHAMapItem const> mItem; std::shared_ptr<SHAMapItem const> mItem;