rippled
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | List of all members
ripple::SHAMapTreeNode Class Referenceabstract
Inheritance diagram for ripple::SHAMapTreeNode:
Inheritance graph
[legend]
Collaboration diagram for ripple::SHAMapTreeNode:
Collaboration graph
[legend]

Public Member Functions

virtual ~SHAMapTreeNode () noexcept=default
 
std::uint32_t cowid () const
 Returns the SHAMap that owns this node. More...
 
void unshare ()
 If this node is shared with another map, mark it as no longer shared. More...
 
virtual std::shared_ptr< SHAMapTreeNodeclone (std::uint32_t cowid) const =0
 Make a copy of this node, setting the owner. More...
 
virtual void updateHash ()=0
 Recalculate the hash of this node. More...
 
SHAMapHash const & getHash () const
 Return the hash of this node. More...
 
virtual SHAMapNodeType getType () const =0
 Determines the type of node. More...
 
virtual bool isLeaf () const =0
 Determines if this is a leaf node. More...
 
virtual bool isInner () const =0
 Determines if this is an inner node. More...
 
virtual void serializeForWire (Serializer &) const =0
 Serialize the node in a format appropriate for sending over the wire. More...
 
virtual void serializeWithPrefix (Serializer &) const =0
 Serialize the node in a format appropriate for hashing. More...
 
virtual std::string getString (SHAMapNodeID const &) const
 
virtual void invariants (bool is_root=false) const =0
 

Static Public Member Functions

static std::shared_ptr< SHAMapTreeNodemakeFromPrefix (Slice rawNode, SHAMapHash const &hash)
 
static std::shared_ptr< SHAMapTreeNodemakeFromWire (Slice rawNode)
 

Protected Member Functions

 SHAMapTreeNode (SHAMapTreeNode const &)=delete
 
SHAMapTreeNodeoperator= (SHAMapTreeNode const &)=delete
 
 SHAMapTreeNode (std::uint32_t cowid) noexcept
 Construct a node. More...
 
 SHAMapTreeNode (std::uint32_t cowid, SHAMapHash const &hash) noexcept
 

Protected Attributes

SHAMapHash hash_
 
std::uint32_t cowid_
 Determines the owning SHAMap, if any. More...
 

Static Private Member Functions

static std::shared_ptr< SHAMapTreeNodemakeTransaction (Slice data, SHAMapHash const &hash, bool hashValid)
 
static std::shared_ptr< SHAMapTreeNodemakeAccountState (Slice data, SHAMapHash const &hash, bool hashValid)
 
static std::shared_ptr< SHAMapTreeNodemakeTransactionWithMeta (Slice data, SHAMapHash const &hash, bool hashValid)
 

Detailed Description

Definition at line 53 of file SHAMapTreeNode.h.

Constructor & Destructor Documentation

◆ SHAMapTreeNode() [1/3]

ripple::SHAMapTreeNode::SHAMapTreeNode ( SHAMapTreeNode const &  )
protecteddelete

◆ SHAMapTreeNode() [2/3]

ripple::SHAMapTreeNode::SHAMapTreeNode ( std::uint32_t  cowid)
explicitprotectednoexcept

Construct a node.

Parameters
cowidThe identifier of a SHAMap. For more, see cowid_
hashThe hash associated with this node, if any.

Definition at line 77 of file SHAMapTreeNode.h.

◆ SHAMapTreeNode() [3/3]

ripple::SHAMapTreeNode::SHAMapTreeNode ( std::uint32_t  cowid,
SHAMapHash const &  hash 
)
explicitprotectednoexcept

Definition at line 81 of file SHAMapTreeNode.h.

◆ ~SHAMapTreeNode()

virtual ripple::SHAMapTreeNode::~SHAMapTreeNode ( )
virtualdefaultnoexcept

Member Function Documentation

◆ operator=()

SHAMapTreeNode& ripple::SHAMapTreeNode::operator= ( SHAMapTreeNode const &  )
protecteddelete

◆ updateHash()

virtual void ripple::SHAMapTreeNode::updateHash ( )
pure virtual

◆ getHash()

SHAMapHash const& ripple::SHAMapTreeNode::getHash ( ) const

Return the hash of this node.

Definition at line 143 of file SHAMapTreeNode.h.

◆ getType()

virtual SHAMapNodeType ripple::SHAMapTreeNode::getType ( ) const
pure virtual

◆ isLeaf()

virtual bool ripple::SHAMapTreeNode::isLeaf ( ) const
pure virtual

Determines if this is a leaf node.

Implemented in ripple::SHAMapInnerNode, and ripple::SHAMapLeafNode.

◆ isInner()

virtual bool ripple::SHAMapTreeNode::isInner ( ) const
pure virtual

Determines if this is an inner node.

Implemented in ripple::SHAMapInnerNode, and ripple::SHAMapLeafNode.

◆ serializeForWire()

virtual void ripple::SHAMapTreeNode::serializeForWire ( Serializer ) const
pure virtual

Serialize the node in a format appropriate for sending over the wire.

Implemented in ripple::SHAMapAccountStateLeafNode, ripple::SHAMapTxPlusMetaLeafNode, ripple::SHAMapTxLeafNode, and ripple::SHAMapInnerNode.

◆ serializeWithPrefix()

virtual void ripple::SHAMapTreeNode::serializeWithPrefix ( Serializer ) const
pure virtual

Serialize the node in a format appropriate for hashing.

Implemented in ripple::SHAMapAccountStateLeafNode, ripple::SHAMapTxPlusMetaLeafNode, ripple::SHAMapTxLeafNode, and ripple::SHAMapInnerNode.

◆ getString()

std::string ripple::SHAMapTreeNode::getString ( SHAMapNodeID const &  id) const
virtual

Reimplemented in ripple::SHAMapInnerNode, and ripple::SHAMapLeafNode.

Definition at line 184 of file SHAMapTreeNode.cpp.

◆ invariants()

virtual void ripple::SHAMapTreeNode::invariants ( bool  is_root = false) const
pure virtual

◆ makeFromPrefix()

std::shared_ptr< SHAMapTreeNode > ripple::SHAMapTreeNode::makeFromPrefix ( Slice  rawNode,
SHAMapHash const &  hash 
)
static

Definition at line 148 of file SHAMapTreeNode.cpp.

◆ makeFromWire()

std::shared_ptr< SHAMapTreeNode > ripple::SHAMapTreeNode::makeFromWire ( Slice  rawNode)
static

Definition at line 116 of file SHAMapTreeNode.cpp.

◆ makeTransaction()

std::shared_ptr< SHAMapTreeNode > ripple::SHAMapTreeNode::makeTransaction ( Slice  data,
SHAMapHash const &  hash,
bool  hashValid 
)
staticprivate

Definition at line 40 of file SHAMapTreeNode.cpp.

◆ makeAccountState()

std::shared_ptr< SHAMapTreeNode > ripple::SHAMapTreeNode::makeAccountState ( Slice  data,
SHAMapHash const &  hash,
bool  hashValid 
)
staticprivate

Definition at line 84 of file SHAMapTreeNode.cpp.

◆ makeTransactionWithMeta()

std::shared_ptr< SHAMapTreeNode > ripple::SHAMapTreeNode::makeTransactionWithMeta ( Slice  data,
SHAMapHash const &  hash,
bool  hashValid 
)
staticprivate

Definition at line 55 of file SHAMapTreeNode.cpp.

Member Data Documentation

◆ hash_

SHAMapHash ripple::SHAMapTreeNode::hash_
protected

Definition at line 56 of file SHAMapTreeNode.h.

◆ cowid_

std::uint32_t ripple::SHAMapTreeNode::cowid_
protected

Determines the owning SHAMap, if any.

Used for copy-on-write semantics.

If this value is 0, the node is not dirty and does not need to be flushed. It is eligible for sharing and may be included multiple SHAMap instances.

Definition at line 64 of file SHAMapTreeNode.h.