Refactor LoadFeeTrack into ILoadFeeTrack, split DatabaseCon out from Application.h

Conflicts:
	src/cpp/ripple/Application.cpp
This commit is contained in:
Vinnie Falco
2013-06-01 08:30:46 -07:00
parent f897b17027
commit ec732ed113
18 changed files with 394 additions and 267 deletions

View File

@@ -23,43 +23,42 @@ SETUP_LOG (Application)
LogPartition AutoSocketPartition("AutoSocket");
Application* theApp = NULL;
int DatabaseCon::sCount = 0;
DatabaseCon::DatabaseCon(const std::string& strName, const char *initStrings[], int initCount)
Application::Application()
: mIOService ((theConfig.NODE_SIZE >= 2) ? 2 : 1)
, mIOWork (mIOService)
, mAuxWork (mAuxService)
, mUNL (mIOService)
, mNetOps (mIOService, &mLedgerMaster)
, mTempNodeCache ("NodeCache", 16384, 90)
, mHashedObjectStore (16384, 300)
, mSLECache ("LedgerEntryCache", 4096, 120)
, mSNTPClient (mAuxService)
, mJobQueue (mIOService)
, mFeeVote (IFeeVote::New (10, 50 * SYSTEM_CURRENCY_PARTS, 12.5 * SYSTEM_CURRENCY_PARTS))
, mFeeTrack (ILoadFeeTrack::New ())
, mFeatureTable (2 * 7 * 24 * 60 * 60, 200) // two weeks, 200/256
// VFALCO: TODO replace all NULL with nullptr
, mRpcDB (NULL)
, mTxnDB (NULL)
, mLedgerDB (NULL)
, mWalletDB (NULL) // VFALCO: NOTE, are all these 'NULL' ctor params necessary?
, mNetNodeDB (NULL)
, mPathFindDB (NULL)
, mHashNodeDB (NULL)
// VFALCO: TODO eliminate USE_LEVELDB macro
#ifdef USE_LEVELDB
, mHashNodeLDB (NULL)
#endif
, mConnectionPool (mIOService)
, mPeerDoor (NULL)
, mRPCDoor (NULL)
, mWSPublicDoor (NULL)
, mWSPrivateDoor (NULL)
, mSweepTimer (mAuxService)
, mShutdown (false)
{
++sCount;
boost::filesystem::path pPath = (theConfig.RUN_STANDALONE && (theConfig.START_UP != Config::LOAD))
? "" // Use temporary files.
: (theConfig.DATA_DIR / strName); // Use regular db files.
mDatabase = new SqliteDatabase(pPath.string().c_str());
mDatabase->connect();
for(int i = 0; i < initCount; ++i)
mDatabase->executeSQL(initStrings[i], true);
}
DatabaseCon::~DatabaseCon()
{
mDatabase->disconnect();
delete mDatabase;
}
Application::Application() :
mIOService((theConfig.NODE_SIZE >= 2) ? 2 : 1),
mIOWork(mIOService), mAuxWork(mAuxService), mUNL(mIOService), mNetOps(mIOService, &mLedgerMaster),
mTempNodeCache("NodeCache", 16384, 90), mHashedObjectStore(16384, 300), mSLECache("LedgerEntryCache", 4096, 120),
mSNTPClient(mAuxService), mJobQueue(mIOService), mFeeTrack(),
mFeeVote (IFeeVote::New (10, 50 * SYSTEM_CURRENCY_PARTS, 12.5 * SYSTEM_CURRENCY_PARTS)),
mFeatureTable(2 * 7 * 24 * 60 * 60, 200), // two weeks, 200/256
mRpcDB(NULL), mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL),
mNetNodeDB(NULL), mPathFindDB(NULL), mHashNodeDB(NULL), mHashNodeLDB(NULL), mEphemeralLDB(NULL),
mConnectionPool(mIOService), mPeerDoor(NULL), mRPCDoor(NULL), mWSPublicDoor(NULL), mWSPrivateDoor(NULL),
mSweepTimer(mAuxService), mShutdown(false)
{
getRand(mNonce256.begin(), mNonce256.size());
getRand(reinterpret_cast<unsigned char *>(&mNonceST), sizeof(mNonceST));
getRand (mNonce256.begin(), mNonce256.size());
getRand (reinterpret_cast<unsigned char *>(&mNonceST), sizeof(mNonceST));
}
extern const char *RpcDBInit[], *TxnDBInit[], *LedgerDBInit[], *WalletDBInit[], *HashNodeDBInit[],
@@ -414,6 +413,7 @@ void Application::sweep()
Application::~Application()
{
delete mFeeTrack;
delete mFeeVote;
delete mTxnDB;
delete mLedgerDB;