Remove application dependency from SyncFilters

This commit is contained in:
Miguel Portilla
2016-10-12 15:22:51 -04:00
committed by Brad Chase
parent cdaafeb4b6
commit 19258cf980
15 changed files with 148 additions and 96 deletions

View File

@@ -19,40 +19,31 @@
#include <BeastConfig.h>
#include <ripple/app/ledger/TransactionStateSF.h>
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/ledger/TransactionMaster.h>
#include <ripple/app/main/Application.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/nodestore/Database.h>
#include <ripple/protocol/HashPrefix.h>
namespace ripple {
TransactionStateSF::TransactionStateSF(Application& app)
: app_ (app)
TransactionStateSF::TransactionStateSF(Family& f,
AbstractFetchPackContainer& fp)
: f_(f)
, fp_(fp)
{
}
// VFALCO This might be better as Blob&&
void TransactionStateSF::gotNode (bool fromFilter,
SHAMapHash const& nodeHash,
Blob&& nodeData,
SHAMapTreeNode::TNType type) const
{
// VFALCO SHAMapSync filters should be passed the SHAMap, the
// SHAMap should provide an accessor to get the injected Database,
// and this should use that Database instad of getNodeStore
assert(type !=
SHAMapTreeNode::tnTRANSACTION_NM);
app_.getNodeStore().store(
hotTRANSACTION_NODE,
std::move (nodeData), nodeHash.as_uint256());
f_.db().store(hotTRANSACTION_NODE,
std::move (nodeData), nodeHash.as_uint256());
}
bool TransactionStateSF::haveNode (SHAMapHash const& nodeHash,
Blob& nodeData) const
boost::optional<Blob>
TransactionStateSF::getNode(SHAMapHash const& nodeHash) const
{
return app_.getLedgerMaster ().getFetchPack (nodeHash.as_uint256(), nodeData);
return fp_.getFetchPack(nodeHash.as_uint256());
}
} // ripple