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

Public Member Functions

 SHAMapLeafNode (const SHAMapLeafNode &)=delete
 
SHAMapLeafNodeoperator= (const SHAMapLeafNode &)=delete
 
bool isLeaf () const final override
 Determines if this is a leaf node. More...
 
bool isInner () const final override
 Determines if this is an inner node. More...
 
void invariants (bool is_root=false) const final override
 
boost::intrusive_ptr< SHAMapItem const > const & peekItem () const
 
bool setItem (boost::intrusive_ptr< SHAMapItem const > i)
 Set the item that this node points to and update the node's hash. More...
 
std::string getString (SHAMapNodeID const &) const final override
 
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 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...
 

Static Public Member Functions

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

Protected Member Functions

 SHAMapLeafNode (boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid)
 
 SHAMapLeafNode (boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid, SHAMapHash const &hash)
 

Protected Attributes

boost::intrusive_ptr< SHAMapItem const > item_
 
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 32 of file SHAMapLeafNode.h.

Constructor & Destructor Documentation

◆ SHAMapLeafNode() [1/3]

ripple::SHAMapLeafNode::SHAMapLeafNode ( boost::intrusive_ptr< SHAMapItem const >  item,
std::uint32_t  cowid 
)
protected

Definition at line 26 of file SHAMapLeafNode.cpp.

◆ SHAMapLeafNode() [2/3]

ripple::SHAMapLeafNode::SHAMapLeafNode ( boost::intrusive_ptr< SHAMapItem const >  item,
std::uint32_t  cowid,
SHAMapHash const &  hash 
)
protected

Definition at line 34 of file SHAMapLeafNode.cpp.

◆ SHAMapLeafNode() [3/3]

ripple::SHAMapLeafNode::SHAMapLeafNode ( const SHAMapLeafNode )
delete

Member Function Documentation

◆ operator=()

SHAMapLeafNode& ripple::SHAMapLeafNode::operator= ( const SHAMapLeafNode )
delete

◆ isLeaf()

bool ripple::SHAMapLeafNode::isLeaf ( ) const
finaloverridevirtual

Determines if this is a leaf node.

Implements ripple::SHAMapTreeNode.

Definition at line 52 of file SHAMapLeafNode.h.

◆ isInner()

bool ripple::SHAMapLeafNode::isInner ( ) const
finaloverridevirtual

Determines if this is an inner node.

Implements ripple::SHAMapTreeNode.

Definition at line 58 of file SHAMapLeafNode.h.

◆ invariants()

void ripple::SHAMapLeafNode::invariants ( bool  is_root = false) const
finaloverridevirtual

Implements ripple::SHAMapTreeNode.

Definition at line 88 of file SHAMapLeafNode.cpp.

◆ peekItem()

boost::intrusive_ptr< SHAMapItem const > const & ripple::SHAMapLeafNode::peekItem ( ) const

Definition at line 44 of file SHAMapLeafNode.cpp.

◆ setItem()

bool ripple::SHAMapLeafNode::setItem ( boost::intrusive_ptr< SHAMapItem const >  i)

Set the item that this node points to and update the node's hash.

Parameters
ithe new item
Returns
false if the change was, effectively, a noop (that is, if the hash was unchanged); true otherwise.

Definition at line 50 of file SHAMapLeafNode.cpp.

◆ getString()

std::string ripple::SHAMapLeafNode::getString ( SHAMapNodeID const &  id) const
finaloverridevirtual

Reimplemented from ripple::SHAMapTreeNode.

Definition at line 63 of file SHAMapLeafNode.cpp.

◆ updateHash()

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

◆ getHash()

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

Return the hash of this node.

Definition at line 143 of file SHAMapTreeNode.h.

◆ getType()

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

◆ serializeForWire()

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

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 virtualinherited

Serialize the node in a format appropriate for hashing.

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

◆ makeFromPrefix()

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

Definition at line 148 of file SHAMapTreeNode.cpp.

◆ makeFromWire()

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

Definition at line 116 of file SHAMapTreeNode.cpp.

◆ makeTransaction()

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

Definition at line 40 of file SHAMapTreeNode.cpp.

◆ makeAccountState()

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

Definition at line 84 of file SHAMapTreeNode.cpp.

◆ makeTransactionWithMeta()

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

Definition at line 55 of file SHAMapTreeNode.cpp.

Member Data Documentation

◆ item_

boost::intrusive_ptr<SHAMapItem const> ripple::SHAMapLeafNode::item_
protected

Definition at line 35 of file SHAMapLeafNode.h.

◆ hash_

SHAMapHash ripple::SHAMapTreeNode::hash_
protectedinherited

Definition at line 56 of file SHAMapTreeNode.h.

◆ cowid_

std::uint32_t ripple::SHAMapTreeNode::cowid_
protectedinherited

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.