|
rippled
|
A leaf node for a transaction. More...
#include <SHAMapTxLeafNode.h>


Public Member Functions | |
| SHAMapTxLeafNode (boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid) | |
| SHAMapTxLeafNode (boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid, SHAMapHash const &hash) | |
| intr_ptr::SharedPtr< SHAMapTreeNode > | clone (std::uint32_t cowid) const final override |
| Make a copy of this node, setting the owner. | |
| SHAMapNodeType | getType () const final override |
| Determines the type of node. | |
| void | updateHash () final override |
| Recalculate the hash of this node. | |
| void | serializeForWire (Serializer &s) const final override |
| Serialize the node in a format appropriate for sending over the wire. | |
| void | serializeWithPrefix (Serializer &s) const final override |
| Serialize the node in a format appropriate for hashing. | |
| bool | isLeaf () const final override |
| Determines if this is a leaf node. | |
| bool | isInner () const final override |
| Determines if this is an inner node. | |
| 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. | |
| std::string | getString (SHAMapNodeID const &) const final override |
| 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. | |
| SHAMapHash const & | getHash () const |
| Return the hash of this node. | |
| 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 | use_count () const noexcept |
Static Public Member Functions | |
| static intr_ptr::SharedPtr< SHAMapTreeNode > | makeFromPrefix (Slice rawNode, SHAMapHash const &hash) |
| static intr_ptr::SharedPtr< SHAMapTreeNode > | makeFromWire (Slice rawNode) |
Protected Attributes | |
| boost::intrusive_ptr< SHAMapItem const > | item_ |
| 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 intr_ptr::SharedPtr< SHAMapTreeNode > | makeTransaction (Slice data, SHAMapHash const &hash, bool hashValid) |
| static intr_ptr::SharedPtr< SHAMapTreeNode > | makeAccountState (Slice data, SHAMapHash const &hash, bool hashValid) |
| static intr_ptr::SharedPtr< SHAMapTreeNode > | makeTransactionWithMeta (Slice data, SHAMapHash const &hash, bool hashValid) |
| static auto & | getCounter () noexcept |
Private Attributes | |
| std::atomic< FieldType > | refCounts {strongDelta} |
refCounts consists of four fields that are treated atomically: | |
Static Private Attributes | |
| static constexpr size_t | StrongCountNumBits = sizeof(CountType) * 8 |
| static constexpr size_t | WeakCountNumBits = StrongCountNumBits - 2 |
| static constexpr size_t | FieldTypeBits = sizeof(FieldType) * 8 |
| static constexpr FieldType | one = 1 |
| static constexpr FieldType | strongDelta = 1 |
| Amount to change the strong count when adding or releasing a reference. | |
| static constexpr FieldType | weakDelta = (one << StrongCountNumBits) |
| Amount to change the weak count when adding or releasing a reference. | |
| static constexpr FieldType | partialDestroyStartedMask |
| Flag that is set when the partialDestroy function has started running (or is about to start running). | |
| static constexpr FieldType | partialDestroyFinishedMask |
| Flag that is set when the partialDestroy function has finished running. | |
| static constexpr FieldType | tagMask |
Mask that will zero out all the count bits and leave the tag bits unchanged. | |
| static constexpr FieldType | valueMask = ~tagMask |
Mask that will zero out the tag bits and leave the count bits unchanged. | |
| static constexpr FieldType | strongMask |
| Mask that will zero out everything except the strong count. | |
| static constexpr FieldType | weakMask |
| Mask that will zero out everything except the weak count. | |
A leaf node for a transaction.
No metadata is included.
Definition at line 13 of file SHAMapTxLeafNode.h.
|
privateinherited |
Definition at line 101 of file IntrusiveRefCounts.h.
|
privateinherited |
Definition at line 104 of file IntrusiveRefCounts.h.
| ripple::SHAMapTxLeafNode::SHAMapTxLeafNode | ( | boost::intrusive_ptr< SHAMapItem const > | item, |
| std::uint32_t | cowid | ||
| ) |
Definition at line 17 of file SHAMapTxLeafNode.h.
| ripple::SHAMapTxLeafNode::SHAMapTxLeafNode | ( | boost::intrusive_ptr< SHAMapItem const > | item, |
| std::uint32_t | cowid, | ||
| SHAMapHash const & | hash | ||
| ) |
Definition at line 25 of file SHAMapTxLeafNode.h.
|
finaloverridevirtual |
Make a copy of this node, setting the owner.
Implements ripple::SHAMapTreeNode.
Definition at line 34 of file SHAMapTxLeafNode.h.
|
finaloverridevirtual |
Determines the type of node.
Implements ripple::SHAMapTreeNode.
Definition at line 40 of file SHAMapTxLeafNode.h.
|
finaloverridevirtual |
Recalculate the hash of this node.
Implements ripple::SHAMapTreeNode.
Definition at line 46 of file SHAMapTxLeafNode.h.
|
finaloverridevirtual |
Serialize the node in a format appropriate for sending over the wire.
Implements ripple::SHAMapTreeNode.
Definition at line 53 of file SHAMapTxLeafNode.h.
|
finaloverridevirtual |
Serialize the node in a format appropriate for hashing.
Implements ripple::SHAMapTreeNode.
Definition at line 60 of file SHAMapTxLeafNode.h.
|
finaloverridevirtualinherited |
Determines if this is a leaf node.
Implements ripple::SHAMapTreeNode.
Definition at line 31 of file SHAMapLeafNode.h.
|
finaloverridevirtualinherited |
Determines if this is an inner node.
Implements ripple::SHAMapTreeNode.
Definition at line 37 of file SHAMapLeafNode.h.
|
finaloverridevirtualinherited |
Implements ripple::SHAMapTreeNode.
Definition at line 74 of file SHAMapLeafNode.cpp.
|
inherited |
Definition at line 30 of file SHAMapLeafNode.cpp.
|
inherited |
Set the item that this node points to and update the node's hash.
| i | the new item |
Definition at line 36 of file SHAMapLeafNode.cpp.
|
finaloverridevirtualinherited |
Reimplemented from ripple::SHAMapTreeNode.
Definition at line 49 of file SHAMapLeafNode.cpp.
|
virtualinherited |
Reimplemented in ripple::SHAMapInnerNode.
Definition at line 72 of file SHAMapTreeNode.h.
|
inherited |
Return the hash of this node.
Definition at line 125 of file SHAMapTreeNode.h.
|
staticinherited |
Definition at line 126 of file SHAMapTreeNode.cpp.
|
staticinherited |
Definition at line 94 of file SHAMapTreeNode.cpp.
|
staticprivateinherited |
Definition at line 16 of file SHAMapTreeNode.cpp.
|
staticprivateinherited |
Definition at line 61 of file SHAMapTreeNode.cpp.
|
staticprivateinherited |
Definition at line 32 of file SHAMapTreeNode.cpp.
|
noexceptinherited |
Definition at line 232 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 238 of file IntrusiveRefCounts.h.
|
inherited |
Definition at line 244 of file IntrusiveRefCounts.h.
|
inherited |
Definition at line 293 of file IntrusiveRefCounts.h.
|
inherited |
Definition at line 347 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 374 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 392 of file IntrusiveRefCounts.h.
|
noexceptinherited |
Definition at line 399 of file IntrusiveRefCounts.h.
|
staticprivatenoexceptinherited |
Definition at line 110 of file CountedObject.h.
|
protectedinherited |
Definition at line 14 of file SHAMapLeafNode.h.
|
protectedinherited |
Definition at line 34 of file SHAMapTreeNode.h.
|
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 42 of file SHAMapTreeNode.h.
|
staticconstexprprivateinherited |
Definition at line 102 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Definition at line 103 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Definition at line 105 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Definition at line 106 of file IntrusiveRefCounts.h.
|
mutableprivateinherited |
refCounts consists of four fields that are treated atomically:
partialDestructor function has been started (or is about to be started). This is used to prevent the destructor from running concurrently with the partial destructor. This can easily happen when the last strong pointer release its reference in one thread and starts the partialDestructor, while in another thread the last weak pointer goes out of scope and starts the destructor while the partialDestructor is still running. Both a start and finished bit is needed to handle a corner-case where the last strong pointer goes out of scope, then then last weakPointer goes out of scope, but this happens before the partialDestructor bit is set. It would be possible to use a single bit if it could also be set atomically when the strong count goes to zero and the weak count is non-zero, but that would add complexity (and likely slow down common cases as well).partialDestructor has finished running. See (3) above for more information. Definition at line 141 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 148 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 155 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 163 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 171 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out all the count bits and leave the tag bits unchanged.
Definition at line 177 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out the tag bits and leave the count bits unchanged.
Definition at line 183 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out everything except the strong count.
Definition at line 187 of file IntrusiveRefCounts.h.
|
staticconstexprprivateinherited |
Mask that will zero out everything except the weak count.
Definition at line 192 of file IntrusiveRefCounts.h.