Refactor Ledger and LedgerEntrySet:

Member functions and free functions on Ledger and LedgerEntrySet are
rewritten in terms of new abstract interfaces `BasicView` and `View`,
representing the set of non-decomposable primitives necessary to read
and write state map items in a ledger, and to overlay a discardable
view onto a Ledger that can calculate metadata during transaction
processing. const-correctness is enforced through the parameter and
return types.

The MetaView now supports multi-level stacking: A MetaView can be
stacked on top of either a Ledger or another MetaView, up to any
number of levels.

The getSLEi member function is removed. The CachedView wrapper
replaces it, wrapping a View such that any function called with a
CachedView will go through the SLECache.

* Add BasicView, View, CachedView
* Rename LedgerEntrySet to MetaView
* Factor out free functions
* Consolidate free functions in ViewAPI
* Remove unused class members and free functions
This commit is contained in:
Vinnie Falco
2015-06-13 20:33:47 -07:00
parent 7d329570f4
commit d468deee12
115 changed files with 5530 additions and 4521 deletions

View File

@@ -19,6 +19,7 @@
#include <BeastConfig.h>
#include <ripple/app/paths/cursor/RippleLiquidity.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h>
namespace ripple {
@@ -195,7 +196,7 @@ TER PathCursor::deliverNodeForward (
// Output: Debit offer owner, send XRP or non-XPR to next
// account.
resultCode = ledger().accountSend (
resultCode = accountSend (ledger(),
node().offerOwnerAccount_,
nextNode().account_,
saOutPassAct);
@@ -252,7 +253,7 @@ TER PathCursor::deliverNodeForward (
auto const& id = isXRP(node().issue_) ?
xrpAccount() : node().issue_.account;
auto outPassTotal = saOutPassAct + saOutPassFees;
ledger().accountSend (
accountSend (ledger(),
node().offerOwnerAccount_,
id,
outPassTotal);
@@ -286,7 +287,7 @@ TER PathCursor::deliverNodeForward (
{
auto id = !isXRP(previousNode().issue_.currency) ?
uInAccountID : xrpAccount();
resultCode = ledger().accountSend (
resultCode = accountSend (ledger(),
id,
node().offerOwnerAccount_,
saInPassAct);
@@ -316,7 +317,7 @@ TER PathCursor::deliverNodeForward (
node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew);
node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew);
ledger().entryModify (node().sleOffer);
ledger().update (node().sleOffer);
if (saOutPassAct == saOutFunded || saTakerGetsNew == zero)
{