rippled
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Private Member Functions | List of all members
ripple::SHAMapTxPlusMetaLeafNode Class Referencefinal

A leaf node for a transaction and its associated metadata. More...

Inheritance diagram for ripple::SHAMapTxPlusMetaLeafNode:
Inheritance graph
[legend]
Collaboration diagram for ripple::SHAMapTxPlusMetaLeafNode:
Collaboration graph
[legend]

Public Member Functions

 SHAMapTxPlusMetaLeafNode (boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid)
 
 SHAMapTxPlusMetaLeafNode (boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid, SHAMapHash const &hash)
 
std::shared_ptr< SHAMapTreeNodeclone (std::uint32_t cowid) const override
 Make a copy of this node, setting the owner. More...
 
SHAMapNodeType getType () const override
 Determines the type of node. More...
 
void updateHash () final override
 Recalculate the hash of this node. More...
 
void serializeForWire (Serializer &s) const final override
 Serialize the node in a format appropriate for sending over the wire. More...
 
void serializeWithPrefix (Serializer &s) const final override
 Serialize the node in a format appropriate for hashing. More...
 
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...
 
SHAMapHash const & getHash () const
 Return the hash of this node. More...
 

Static Public Member Functions

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

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)
 
static auto & getCounter () noexcept
 

Detailed Description

A leaf node for a transaction and its associated metadata.

Definition at line 33 of file SHAMapTxPlusMetaLeafNode.h.

Constructor & Destructor Documentation

◆ SHAMapTxPlusMetaLeafNode() [1/2]

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

Definition at line 38 of file SHAMapTxPlusMetaLeafNode.h.

◆ SHAMapTxPlusMetaLeafNode() [2/2]

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

Definition at line 46 of file SHAMapTxPlusMetaLeafNode.h.

Member Function Documentation

◆ clone()

std::shared_ptr<SHAMapTreeNode> ripple::SHAMapTxPlusMetaLeafNode::clone ( std::uint32_t  cowid) const
overridevirtual

Make a copy of this node, setting the owner.

Implements ripple::SHAMapTreeNode.

Definition at line 55 of file SHAMapTxPlusMetaLeafNode.h.

◆ getType()

SHAMapNodeType ripple::SHAMapTxPlusMetaLeafNode::getType ( ) const
overridevirtual

Determines the type of node.

Implements ripple::SHAMapTreeNode.

Definition at line 61 of file SHAMapTxPlusMetaLeafNode.h.

◆ updateHash()

void ripple::SHAMapTxPlusMetaLeafNode::updateHash ( )
finaloverridevirtual

Recalculate the hash of this node.

Implements ripple::SHAMapTreeNode.

Definition at line 67 of file SHAMapTxPlusMetaLeafNode.h.

◆ serializeForWire()

void ripple::SHAMapTxPlusMetaLeafNode::serializeForWire ( Serializer ) const
finaloverridevirtual

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

Implements ripple::SHAMapTreeNode.

Definition at line 74 of file SHAMapTxPlusMetaLeafNode.h.

◆ serializeWithPrefix()

void ripple::SHAMapTxPlusMetaLeafNode::serializeWithPrefix ( Serializer ) const
finaloverridevirtual

Serialize the node in a format appropriate for hashing.

Implements ripple::SHAMapTreeNode.

Definition at line 82 of file SHAMapTxPlusMetaLeafNode.h.

◆ isLeaf()

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

Determines if this is a leaf node.

Implements ripple::SHAMapTreeNode.

Definition at line 52 of file SHAMapLeafNode.h.

◆ isInner()

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

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
finaloverridevirtualinherited

Implements ripple::SHAMapTreeNode.

Definition at line 88 of file SHAMapLeafNode.cpp.

◆ peekItem()

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

Definition at line 44 of file SHAMapLeafNode.cpp.

◆ setItem()

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

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
finaloverridevirtualinherited

Reimplemented from ripple::SHAMapTreeNode.

Definition at line 63 of file SHAMapLeafNode.cpp.

◆ getHash()

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

Return the hash of this node.

Definition at line 143 of file SHAMapTreeNode.h.

◆ 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.

◆ getCounter()

static auto& ripple::CountedObject< SHAMapTxPlusMetaLeafNode >::getCounter
staticprivatenoexceptinherited

Definition at line 128 of file CountedObject.h.

Member Data Documentation

◆ item_

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

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.