3#include <xrpl/basics/IntrusivePointer.h>
4#include <xrpl/basics/IntrusiveRefCounts.h>
5#include <xrpl/basics/SHAMapHash.h>
6#include <xrpl/protocol/Serializer.h>
7#include <xrpl/shamap/SHAMapItem.h>
8#include <xrpl/shamap/SHAMapNodeID.h>
Identifies a node inside a SHAMap.
static SHAMapTreeNodePtr makeFromPrefix(Slice rawNode, SHAMapHash const &hash)
static SHAMapTreeNodePtr makeFromWire(Slice rawNode)
static SHAMapTreeNodePtr makeAccountState(Slice data, SHAMapHash const &hash, bool hashValid)
SHAMapHash const & getHash() const
Return the hash of this node.
virtual void serializeWithPrefix(Serializer &) const =0
Serialize the node in a format appropriate for hashing.
std::uint32_t cowid_
Determines the owning SHAMap, if any.
virtual void serializeForWire(Serializer &) const =0
Serialize the node in a format appropriate for sending over the wire.
virtual SHAMapNodeType getType() const =0
Determines the type of node.
virtual void partialDestructor()
virtual bool isLeaf() const =0
Determines if this is a leaf node.
static SHAMapTreeNodePtr makeTransaction(Slice data, SHAMapHash const &hash, bool hashValid)
virtual bool isInner() const =0
Determines if this is an inner node.
virtual void invariants(bool isRoot=false) const =0
SHAMapTreeNode(std::uint32_t cowid) noexcept
Construct a node.
~SHAMapTreeNode() noexcept override=default
SHAMapTreeNode(std::uint32_t cowid, SHAMapHash const &hash) noexcept
static SHAMapTreeNodePtr makeTransactionWithMeta(Slice data, SHAMapHash const &hash, bool hashValid)
virtual std::string getString(SHAMapNodeID const &) const
virtual void updateHash()=0
Recalculate the hash of this node.
An immutable linear range of bytes.
virtual SHAMapTreeNodePtr clone(std::uint32_t cowid) const =0
Make a copy of this node, setting the owner.
void unshare()
If this node is shared with another map, mark it as no longer shared.
std::uint32_t cowid() const
Returns the SHAMap that owns this node.
SharedIntrusive< T > SharedPtr
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
intr_ptr::SharedPtr< SHAMapTreeNode > SHAMapTreeNodePtr
static constexpr unsigned char const kWireTypeTransactionWithMeta
static constexpr unsigned char const kWireTypeCompressedInner
constexpr std::size_t kMinShaMapItemBytes
static constexpr unsigned char const kWireTypeAccountState
static constexpr unsigned char const kWireTypeTransaction
static constexpr unsigned char const kWireTypeInner
Implement the strong count, weak count, and bit flags for an intrusive pointer.