mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Refactor and improve the SHAMap code:
This commit combines a number of cleanups, targeting both the code structure and the code logic. Large changes include: - Using more strongly-typed classes for SHAMap nodes, instead of relying on runtime-time detection of class types. This change saves 16 bytes of memory per node. - Improving the interface of SHAMap::addGiveItem and SHAMap::addItem to avoid the need for passing two bool arguments. - Documenting the "copy-on-write" semantics that SHAMap uses to efficiently track changes in individual nodes. - Removing unused code and simplifying several APIs. - Improving function naming.
This commit is contained in:
@@ -108,7 +108,7 @@ TransactionMaster::fetch(
|
||||
std::shared_ptr<STTx const>
|
||||
TransactionMaster::fetch(
|
||||
std::shared_ptr<SHAMapItem> const& item,
|
||||
SHAMapTreeNode::TNType type,
|
||||
SHAMapNodeType type,
|
||||
std::uint32_t uCommitLedger)
|
||||
{
|
||||
std::shared_ptr<STTx const> txn;
|
||||
@@ -116,12 +116,12 @@ TransactionMaster::fetch(
|
||||
|
||||
if (!iTx)
|
||||
{
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
if (type == SHAMapNodeType::tnTRANSACTION_NM)
|
||||
{
|
||||
SerialIter sit(item->slice());
|
||||
txn = std::make_shared<STTx const>(std::ref(sit));
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
else if (type == SHAMapNodeType::tnTRANSACTION_MD)
|
||||
{
|
||||
auto blob = SerialIter{item->data(), item->size()}.getVL();
|
||||
txn = std::make_shared<STTx const>(
|
||||
|
||||
Reference in New Issue
Block a user