rippled
|
By nature, a node may appear in multiple SHAMap instances. Rather than actually duplicating these nodes, SHAMap opts to be memory efficient and uses copy-on-write semantics for nodes. More...
Functions | |
std::uint32_t | ripple::SHAMapTreeNode::cowid () const |
Returns the SHAMap that owns this node. More... | |
void | ripple::SHAMapTreeNode::unshare () |
If this node is shared with another map, mark it as no longer shared. More... | |
virtual std::shared_ptr< SHAMapTreeNode > | ripple::SHAMapTreeNode::clone (std::uint32_t cowid) const =0 |
Make a copy of this node, setting the owner. More... | |
By nature, a node may appear in multiple SHAMap instances. Rather than actually duplicating these nodes, SHAMap opts to be memory efficient and uses copy-on-write semantics for nodes.
Only nodes that are not modified and don't need to be flushed back can be shared. Once a node needs to be changed, it must first be copied and the copy must marked as not shareable.
Note that just because a node may not be owned by a given SHAMap instance does not mean that the node is NOT a part of any SHAMap. It only means that the node is not owned exclusively by any one SHAMap.
For more on copy-on-write, check out: https://en.wikipedia.org/wiki/Copy-on-write
std::uint32_t ripple::SHAMapTreeNode::cowid | ( | ) | const |
Returns the SHAMap that owns this node.
Definition at line 116 of file SHAMapTreeNode.h.
void ripple::SHAMapTreeNode::unshare | ( | ) |
If this node is shared with another map, mark it as no longer shared.
Only nodes that are not modified and do not need to be flushed back should be marked as unshared.
Definition at line 127 of file SHAMapTreeNode.h.
|
pure virtual |
Make a copy of this node, setting the owner.
Implemented in ripple::SHAMapInnerNode, ripple::SHAMapTxPlusMetaLeafNode, ripple::SHAMapAccountStateLeafNode, and ripple::SHAMapTxLeafNode.