You can now create a LedgerEntrySet without a TransactionEngine. You can

call all the various entry* functions on it directly. You can throw it out
when you're done. The constructor is:

    LedgerEntrySet(Ledger::ref ledger)

All the normal checkpointing, caching, and swapping will work. Of course,
you cannot commit the results. The TransactionEngine::entry* functions now
just directly call the corresponding functions on the LedgerEntrySet. You
can call them in code that will only be used in the context of a
transaction.
This commit is contained in:
JoelKatz
2012-09-08 00:48:26 -07:00
parent 63921c9757
commit 1a1952ea7b
4 changed files with 55 additions and 68 deletions

View File

@@ -865,50 +865,6 @@ TER TransactionEngine::setAuthorized(const SerializedTransaction& txn, bool bMus
return tesSUCCESS;
}
SLE::pointer TransactionEngine::entryCache(LedgerEntryType letType, const uint256& uIndex)
{
SLE::pointer sleEntry;
if (!!uIndex)
{
LedgerEntryAction action;
sleEntry = mNodes.getEntry(uIndex, action);
if (!sleEntry)
{
sleEntry = mLedger->getSLE(uIndex);
if (sleEntry)
mNodes.entryCache(sleEntry);
}
else if (action == taaDELETE)
{
assert(false);
}
}
return sleEntry;
}
SLE::pointer TransactionEngine::entryCreate(LedgerEntryType letType, const uint256& uIndex)
{
assert(!!uIndex);
SLE::pointer sleNew = boost::make_shared<SerializedLedgerEntry>(letType);
sleNew->setIndex(uIndex);
mNodes.entryCreate(sleNew);
return sleNew;
}
void TransactionEngine::entryDelete(SLE::pointer sleEntry, bool bUnfunded)
{
mNodes.entryDelete(sleEntry, bUnfunded);
}
void TransactionEngine::entryModify(SLE::pointer sleEntry)
{
mNodes.entryModify(sleEntry);
}
void TransactionEngine::txnWrite()
{
// Write back the account states and add the transaction to the ledger
@@ -956,12 +912,11 @@ void TransactionEngine::txnWrite()
}
}
TER TransactionEngine::applyTransaction(const SerializedTransaction& txn,
TransactionEngineParams params)
TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, TransactionEngineParams params)
{
Log(lsTRACE) << "applyTransaction>";
assert(mLedger);
mNodes.init(txn.getTransactionID(), mLedger->getLedgerSeq());
mNodes.init(mLedger, txn.getTransactionID(), mLedger->getLedgerSeq());
#ifdef DEBUG
if (1)