20 #ifndef RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED
21 #define RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED
23 #include <ripple/basics/CountedObject.h>
24 #include <ripple/basics/SHAMapHash.h>
25 #include <ripple/basics/TaggedCache.h>
26 #include <ripple/beast/utility/Journal.h>
27 #include <ripple/protocol/Serializer.h>
28 #include <ripple/shamap/SHAMapItem.h>
29 #include <ripple/shamap/SHAMapNodeID.h>
std::uint32_t cowid() const
Returns the SHAMap that owns this node.
An immutable linear range of bytes.
std::uint32_t cowid_
Determines the owning SHAMap, if any.
virtual void serializeWithPrefix(Serializer &) const =0
Serialize the node in a format appropriate for hashing.
SHAMapTreeNode & operator=(SHAMapTreeNode const &)=delete
virtual void invariants(bool is_root=false) const =0
void unshare()
If this node is shared with another map, mark it as no longer shared.
static constexpr unsigned const char wireTypeTransaction
static constexpr unsigned const char wireTypeInner
static std::shared_ptr< SHAMapTreeNode > makeFromWire(Slice rawNode)
Identifies a node inside a SHAMap.
virtual std::shared_ptr< SHAMapTreeNode > clone(std::uint32_t cowid) const =0
Make a copy of this node, setting the owner.
virtual std::string getString(SHAMapNodeID const &) const
virtual bool isInner() const =0
Determines if this is an inner node.
static constexpr unsigned const char wireTypeTransactionWithMeta
static constexpr unsigned const char wireTypeAccountState
static std::shared_ptr< SHAMapTreeNode > makeTransaction(Slice data, SHAMapHash const &hash, bool hashValid)
static std::shared_ptr< SHAMapTreeNode > makeTransactionWithMeta(Slice data, SHAMapHash const &hash, bool hashValid)
virtual bool isLeaf() const =0
Determines if this is a leaf node.
SHAMapTreeNode(SHAMapTreeNode const &)=delete
SHAMapTreeNode(std::uint32_t cowid) noexcept
Construct a node.
virtual void updateHash()=0
Recalculate the hash of this node.
SHAMapHash const & getHash() const
Return the hash of this node.
static constexpr unsigned const char wireTypeCompressedInner
static std::shared_ptr< SHAMapTreeNode > makeFromPrefix(Slice rawNode, SHAMapHash const &hash)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual SHAMapNodeType getType() const =0
Determines the type of node.
virtual ~SHAMapTreeNode() noexcept=default
virtual void serializeForWire(Serializer &) const =0
Serialize the node in a format appropriate for sending over the wire.
SHAMapTreeNode(std::uint32_t cowid, SHAMapHash const &hash) noexcept
static std::shared_ptr< SHAMapTreeNode > makeAccountState(Slice data, SHAMapHash const &hash, bool hashValid)