mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove LedgerBase and decongest Ledger locks
This commit is contained in:
@@ -301,7 +301,9 @@ public:
|
||||
|
||||
if (cit == m_cache.end ())
|
||||
{
|
||||
m_cache.insert (cache_pair (key, Entry (m_clock.now(), data)));
|
||||
m_cache.emplace (std::piecewise_construct,
|
||||
std::forward_as_tuple(key),
|
||||
std::forward_as_tuple(m_clock.now(), data));
|
||||
++m_cache_count;
|
||||
return false;
|
||||
}
|
||||
@@ -526,7 +528,6 @@ private:
|
||||
void touch (clock_type::time_point const& now) { last_access = now; }
|
||||
};
|
||||
|
||||
typedef std::pair <key_type, Entry> cache_pair;
|
||||
typedef hardened_hash_map <key_type, Entry, Hash, KeyEqual> cache_type;
|
||||
typedef typename cache_type::iterator cache_iterator;
|
||||
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
LedgerBase::LedgerBase ()
|
||||
{
|
||||
}
|
||||
|
||||
Ledger::Ledger (const RippleAddress& masterID, std::uint64_t startAmount)
|
||||
: mTotCoins (startAmount)
|
||||
, mLedgerSeq (1) // First Ledger
|
||||
@@ -1162,8 +1158,6 @@ Json::Value Ledger::getJson (int options)
|
||||
bool const bFull (options & LEDGER_JSON_FULL);
|
||||
bool const bExpand (options & LEDGER_JSON_EXPAND);
|
||||
|
||||
ScopedLockType sl (mLock);
|
||||
|
||||
// DEPRECATED
|
||||
ledger[jss::seqNum]
|
||||
= beast::lexicalCastThrow <std::string> (mLedgerSeq);
|
||||
|
||||
@@ -46,20 +46,6 @@ enum LedgerStateParms
|
||||
|
||||
class SqliteStatement;
|
||||
|
||||
class LedgerBase
|
||||
{
|
||||
protected:
|
||||
LedgerBase ();
|
||||
|
||||
// VFALCO TODO eliminate the need for friends
|
||||
friend class TransactionEngine;
|
||||
friend class Transactor;
|
||||
|
||||
typedef RippleRecursiveMutex LockType;
|
||||
typedef std::lock_guard <LockType> ScopedLockType;
|
||||
LockType mLock;
|
||||
};
|
||||
|
||||
// VFALCO TODO figure out exactly how this thing works.
|
||||
// It seems like some ledger database is stored as a global, static in the
|
||||
// class. But then what is the meaning of a Ledger object? Is this
|
||||
@@ -73,7 +59,6 @@ protected:
|
||||
*/
|
||||
class Ledger
|
||||
: public std::enable_shared_from_this <Ledger>
|
||||
, public LedgerBase
|
||||
, public CountedObject <Ledger>
|
||||
, public beast::Uncopyable
|
||||
{
|
||||
|
||||
@@ -262,9 +262,6 @@ TER Transactor::apply ()
|
||||
if (terResult != tesSUCCESS)
|
||||
return (terResult);
|
||||
|
||||
// Restructure this to avoid the dependency on LedgerBase::mLock
|
||||
Ledger::ScopedLockType sl (mEngine->getLedger ()->mLock);
|
||||
|
||||
mTxnAccount = mEngine->entryCache (ltACCOUNT_ROOT,
|
||||
Ledger::getAccountRootIndex (mTxnAccountID));
|
||||
calculateFee ();
|
||||
|
||||
Reference in New Issue
Block a user