mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Move to new directory format.
This commit is contained in:
@@ -29,7 +29,8 @@ LedgerStateParms Ledger::writeBack(LedgerStateParms parms, SLE::pointer entry)
|
||||
if (create)
|
||||
{
|
||||
assert(!mAccountStateMap->hasItem(entry->getIndex()));
|
||||
if(!mAccountStateMap->addGiveItem(item, false))
|
||||
|
||||
if (!mAccountStateMap->addGiveItem(item, false))
|
||||
{
|
||||
assert(false);
|
||||
return lepERROR;
|
||||
@@ -68,7 +69,7 @@ SLE::pointer Ledger::getASNode(LedgerStateParms& parms, const uint256& nodeID,
|
||||
SLE::pointer sle =
|
||||
boost::make_shared<SLE>(account->peekSerializer(), nodeID);
|
||||
|
||||
if(sle->getType() != let)
|
||||
if (sle->getType() != let)
|
||||
{ // maybe it's a currency or something
|
||||
parms = parms | lepWRONGTYPE;
|
||||
return SLE::pointer();
|
||||
@@ -92,6 +93,17 @@ SLE::pointer Ledger::getAccountRoot(LedgerStateParms& parms, const NewcoinAddres
|
||||
return getAccountRoot(parms, naAccountID.getAccountID());
|
||||
}
|
||||
|
||||
//
|
||||
// Directory
|
||||
//
|
||||
|
||||
SLE::pointer Ledger::getDirNode(LedgerStateParms& parms, const uint256& uNodeIndex)
|
||||
{
|
||||
ScopedLock l(mAccountStateMap->Lock());
|
||||
|
||||
return getASNode(parms, uNodeIndex, ltDIR_NODE);
|
||||
}
|
||||
|
||||
//
|
||||
// Generator Map
|
||||
//
|
||||
@@ -137,36 +149,4 @@ SLE::pointer Ledger::getRippleState(LedgerStateParms& parms, const uint256& uNod
|
||||
return getASNode(parms, uNode, ltRIPPLE_STATE);
|
||||
}
|
||||
|
||||
//
|
||||
// Directory
|
||||
//
|
||||
|
||||
// For a directory entry put in the 64 bit index or quality.
|
||||
uint256 Ledger::getDirIndex(const uint256& uBase, const uint64 uNodeDir)
|
||||
{
|
||||
// Indexes are stored in big endian format: they print as hex as stored.
|
||||
// Most significant bytes are first. Least significant bytes repesent adjcent entries.
|
||||
// We place uNodeDir in the 8 right most bytes to be adjcent.
|
||||
// Want uNodeDir in big endian format so ++ goes to the next entry for indexes.
|
||||
uint256 uNode(uBase);
|
||||
|
||||
((uint64*) uNode.end())[-1] = htobe64(uNodeDir);
|
||||
|
||||
return uNode;
|
||||
}
|
||||
|
||||
SLE::pointer Ledger::getDirRoot(LedgerStateParms& parms, const uint256& uRootIndex)
|
||||
{
|
||||
ScopedLock l(mAccountStateMap->Lock());
|
||||
|
||||
return getASNode(parms, uRootIndex, ltDIR_ROOT);
|
||||
}
|
||||
|
||||
SLE::pointer Ledger::getDirNode(LedgerStateParms& parms, const uint256& uNodeIndex)
|
||||
{
|
||||
ScopedLock l(mAccountStateMap->Lock());
|
||||
|
||||
return getASNode(parms, uNodeIndex, ltDIR_NODE);
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user