Add CachedLedger:

This type alias provide cache-wrapping for Ledger objects.
Through the CachedLedger interface, access to the underlying
Ledger is permitted to allow for cases where the implementation
must perform Ledger specific activities. For example, building
a fetch pack from the contained SHAMap objects.

The CachingReadView is refactored:

* Renamed to CachedView
* Templated on Base, the base type
* base() returns a shared_ptr to the wrapped object
* Constructor requires a shared_ptr<Base>
This commit is contained in:
Vinnie Falco
2015-07-15 14:58:08 -07:00
parent fad9998f9d
commit 110bbf3956
8 changed files with 85 additions and 72 deletions

View File

@@ -20,13 +20,13 @@
#include <BeastConfig.h>
#include <ripple/app/ledger/OpenLedger.h>
#include <ripple/app/tx/apply.h>
#include <ripple/ledger/CachingReadView.h>
#include <ripple/ledger/CachedView.h>
#include <boost/range/adaptor/transformed.hpp>
namespace ripple {
OpenLedger::OpenLedger(
std::shared_ptr<Ledger const> const& ledger,
OpenLedger::OpenLedger(std::shared_ptr<
Ledger const> const& ledger,
Config const& config, CachedSLEs& cache,
beast::Journal journal)
: j_ (journal)
@@ -65,7 +65,7 @@ OpenLedger::modify (std::function<
}
void
OpenLedger::accept (std::shared_ptr<
OpenLedger::accept(std::shared_ptr<
Ledger const> const& ledger,
OrderedTxs const& locals, bool retriesFirst,
OrderedTxs& retries, ApplyFlags flags,
@@ -113,12 +113,12 @@ OpenLedger::accept (std::shared_ptr<
//------------------------------------------------------------------------------
std::shared_ptr<OpenView>
OpenLedger::create (std::shared_ptr<
OpenLedger::create(std::shared_ptr<
Ledger const> const& ledger)
{
return std::make_shared<OpenView>(
open_ledger, std::make_shared<
CachingReadView const>(ledger,
CachedLedger const>(ledger,
cache_));
}