|
xrpld
|
#include <SHAMapTreeNode.h>


Public Member Functions | |
| ~SHAMapTreeNode () noexcept override=default | |
| SHAMapTreeNode (SHAMapTreeNode const &)=delete | |
| SHAMapTreeNode & | operator= (SHAMapTreeNode const &)=delete |
| virtual void | partialDestructor () |
| std::uint32_t | cowid () const |
| Returns the SHAMap that owns this node. | |
| void | unshare () |
| If this node is shared with another map, mark it as no longer shared. | |
| virtual SHAMapTreeNodePtr | clone (std::uint32_t cowid) const =0 |
| Make a copy of this node, setting the owner. | |
| virtual void | updateHash ()=0 |
| Recalculate the hash of this node. | |
| SHAMapHash const & | getHash () const |
| Return the hash of this node. | |
| virtual SHAMapNodeType | getType () const =0 |
| Determines the type of node. | |
| virtual bool | isLeaf () const =0 |
| Determines if this is a leaf node. | |
| virtual bool | isInner () const =0 |
| Determines if this is an inner node. | |
| virtual void | serializeForWire (Serializer &) const =0 |
| Serialize the node in a format appropriate for sending over the wire. | |
| virtual void | serializeWithPrefix (Serializer &) const =0 |
| Serialize the node in a format appropriate for hashing. | |
| virtual std::string | getString (SHAMapNodeID const &) const |
| virtual void | invariants (bool isRoot=false) const =0 |
| void | addStrongRef () const noexcept |
| void | addWeakRef () const noexcept |
| ReleaseStrongRefAction | releaseStrongRef () const |
| ReleaseStrongRefAction | addWeakReleaseStrongRef () const |
| ReleaseWeakRefAction | releaseWeakRef () const |
| bool | checkoutStrongRefFromWeak () const noexcept |
| bool | expired () const noexcept |
| std::size_t | useCount () const noexcept |
Static Public Member Functions | |
| static SHAMapTreeNodePtr | makeFromPrefix (Slice rawNode, SHAMapHash const &hash) |
| static SHAMapTreeNodePtr | makeFromWire (Slice rawNode) |
Protected Member Functions | |
| SHAMapTreeNode (std::uint32_t cowid) noexcept | |
| Construct a node. | |
| SHAMapTreeNode (std::uint32_t cowid, SHAMapHash const &hash) noexcept | |
Protected Attributes | |
| SHAMapHash | hash_ |
| std::uint32_t | cowid_ |
| Determines the owning SHAMap, if any. | |
Private Types | |
| using | CountType = std::uint16_t |
| using | FieldType = std::uint32_t |
Static Private Member Functions | |
| static SHAMapTreeNodePtr | makeTransaction (Slice data, SHAMapHash const &hash, bool hashValid) |
| static SHAMapTreeNodePtr | makeAccountState (Slice data, SHAMapHash const &hash, bool hashValid) |
| static SHAMapTreeNodePtr | makeTransactionWithMeta (Slice data, SHAMapHash const &hash, bool hashValid) |
Private Attributes | |
| std::atomic< FieldType > | refCounts_ {kStrongDelta} |
| refCounts consists of four fields that are treated atomically: | |
Static Private Attributes | |
| static constexpr size_t | kStrongCountNumBits = sizeof(CountType) * 8 |
| static constexpr size_t | kWeakCountNumBits = kStrongCountNumBits - 2 |
| static constexpr size_t | kFieldTypeBits = sizeof(FieldType) * 8 |
| static constexpr FieldType | kOne = 1 |
| static constexpr FieldType | kStrongDelta = 1 |
| Amount to change the strong count when adding or releasing a reference. | |
| static constexpr FieldType | kWeakDelta = (kOne << kStrongCountNumBits) |
| Amount to change the weak count when adding or releasing a reference. | |
| static constexpr FieldType | kPartialDestroyStartedMask = (kOne << (kFieldTypeBits - 1)) |
| Flag that is set when the partialDestroy function has started running (or is about to start running). | |
| static constexpr FieldType | kPartialDestroyFinishedMask = (kOne << (kFieldTypeBits - 2)) |
| Flag that is set when the partialDestroy function has finished running. | |
| static constexpr FieldType | kTagMask = kPartialDestroyStartedMask | kPartialDestroyFinishedMask |
| Mask that will zero out all the count bits and leave the tag bits unchanged. | |
| static constexpr FieldType | kValueMask = ~kTagMask |
| Mask that will zero out the tag bits and leave the count bits unchanged. | |
| static constexpr FieldType | kStrongMask = ((kOne << kStrongCountNumBits) - 1) & kValueMask |
| Mask that will zero out everything except the strong count. | |
| static constexpr FieldType | kWeakMask |
| Mask that will zero out everything except the weak count. | |
Definition at line 37 of file SHAMapTreeNode.h.
|
privateinherited |
Definition at line 96 of file IntrusiveRefCounts.h.
|
privateinherited |
Definition at line 99 of file IntrusiveRefCounts.h.
|
explicitprotectednoexcept |
Construct a node.
| cowid | The identifier of a SHAMap. For more, see cowid_ |
| hash | The hash associated with this node, if any. |
Definition at line 58 of file SHAMapTreeNode.h.
|
explicitprotectednoexcept |
Definition at line 62 of file SHAMapTreeNode.h.
|
overridedefaultnoexcept |
|
delete |
|
delete |
|
virtual |
Reimplemented in xrpl::SHAMapInnerNode.
Definition at line 77 of file SHAMapTreeNode.h.
|
pure virtual |
Recalculate the hash of this node.
Implemented in xrpl::SHAMapAccountStateLeafNode, xrpl::SHAMapInnerNode, xrpl::SHAMapTxLeafNode, and xrpl::SHAMapTxPlusMetaLeafNode.
| SHAMapHash const & xrpl::SHAMapTreeNode::getHash | ( | ) | const |
Return the hash of this node.
Definition at line 139 of file SHAMapTreeNode.h.
|
pure virtual |
Determines the type of node.
Implemented in xrpl::SHAMapAccountStateLeafNode, xrpl::SHAMapInnerNode, xrpl::SHAMapTxLeafNode, and xrpl::SHAMapTxPlusMetaLeafNode.
|
pure virtual |
Determines if this is a leaf node.
Implemented in xrpl::SHAMapInnerNode, and xrpl::SHAMapLeafNode.
|
pure virtual |
Determines if this is an inner node.
Implemented in xrpl::SHAMapInnerNode, and xrpl::SHAMapLeafNode.
|
pure virtual |
Serialize the node in a format appropriate for sending over the wire.
Implemented in xrpl::SHAMapAccountStateLeafNode, xrpl::SHAMapInnerNode, xrpl::SHAMapTxLeafNode, and xrpl::SHAMapTxPlusMetaLeafNode.
|
pure virtual |
Serialize the node in a format appropriate for hashing.
Implemented in xrpl::SHAMapAccountStateLeafNode, xrpl::SHAMapInnerNode, xrpl::SHAMapTxLeafNode, and xrpl::SHAMapTxPlusMetaLeafNode.
|
virtual |
Reimplemented in xrpl::SHAMapInnerNode, and xrpl::SHAMapLeafNode.
Definition at line 189 of file SHAMapTreeNode.cpp.
|
pure virtual |
Implemented in xrpl::SHAMapInnerNode, and xrpl::SHAMapLeafNode.
|
static |
Definition at line 157 of file SHAMapTreeNode.cpp.
|
static |
Definition at line 126 of file SHAMapTreeNode.cpp.
|
staticprivate |
Definition at line 30 of file SHAMapTreeNode.cpp.
|
staticprivate |
Definition at line 85 of file SHAMapTreeNode.cpp.
|
staticprivate |
Definition at line 47 of file SHAMapTreeNode.cpp.
|
noexceptinherited |
Definition at line 238 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 244 of file IntrusiveRefCounts.h.
|
inherited |
Definition at line 250 of file IntrusiveRefCounts.h.
|
inherited |
Definition at line 298 of file IntrusiveRefCounts.h.
|
inherited |
Definition at line 347 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 376 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 393 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 400 of file IntrusiveRefCounts.h.
|
protected |
Definition at line 40 of file SHAMapTreeNode.h.
|
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 49 of file SHAMapTreeNode.h.
|
staticconstexprprivateinherited |
Definition at line 97 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Definition at line 98 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Definition at line 100 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Definition at line 101 of file IntrusiveRefCounts.h.
|
mutableprivateinherited |
refCounts consists of four fields that are treated atomically:
Definition at line 136 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Amount to change the strong count when adding or releasing a reference.
Note: The strong count is stored in the low StrongCountNumBits bits of refCounts
Definition at line 144 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Amount to change the weak count when adding or releasing a reference.
Note: The weak count is stored in the high WeakCountNumBits bits of refCounts
Definition at line 152 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Flag that is set when the partialDestroy function has started running (or is about to start running).
See description of the refCounts field for a fuller description of this field.
Definition at line 161 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Flag that is set when the partialDestroy function has finished running.
See description of the refCounts field for a fuller description of this field.
Definition at line 169 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out all the count bits and leave the tag bits unchanged.
Definition at line 175 of file IntrusiveRefCounts.h.
Mask that will zero out the tag bits and leave the count bits unchanged.
Definition at line 181 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out everything except the strong count.
Definition at line 186 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out everything except the weak count.
Definition at line 191 of file IntrusiveRefCounts.h.