From d6fb686426182b18bae99c0b15f8ff5e079945df Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 10 Jul 2013 10:28:15 -0700 Subject: [PATCH] Rename to NodeObject --- Builds/VisualStudio2012/RippleD.vcxproj | 4 +- .../VisualStudio2012/RippleD.vcxproj.filters | 8 +- .../ripple_app/node/ripple_HSBELevelDB.cpp | 18 ++-- modules/ripple_app/node/ripple_HSBELevelDB.h | 12 +-- modules/ripple_app/node/ripple_HSBESqlite.cpp | 22 ++--- modules/ripple_app/node/ripple_HSBESqlite.h | 12 +-- modules/ripple_app/node/ripple_HashStoreBE.h | 8 +- .../node/ripple_HashedObjectStore.cpp | 88 +++++++++---------- .../node/ripple_HashedObjectStore.h | 22 ++--- ...HashedObject.cpp => ripple_NodeObject.cpp} | 18 ++-- ...ple_HashedObject.h => ripple_NodeObject.h} | 18 ++-- modules/ripple_app/ripple_app.cpp | 4 +- src/cpp/ripple/ripple_InboundLedger.cpp | 2 +- src/cpp/ripple/ripple_Peer.cpp | 2 +- src/cpp/ripple/ripple_SHAMap.cpp | 4 +- src/cpp/ripple/ripple_SHAMap.h | 2 +- 16 files changed, 122 insertions(+), 122 deletions(-) rename modules/ripple_app/node/{ripple_HashedObject.cpp => ripple_NodeObject.cpp} (72%) rename modules/ripple_app/node/{ripple_HashedObject.h => ripple_NodeObject.h} (83%) diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj index 2053bf907..edc2dd367 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj +++ b/Builds/VisualStudio2012/RippleD.vcxproj @@ -25,7 +25,7 @@ true true - + true true true @@ -1342,7 +1342,7 @@ - + diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters index 7f38d7aa8..374dc3ef2 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters @@ -855,10 +855,10 @@ [1] Ripple\ripple_app\node - + [1] Ripple\ripple_app\node - + [1] Ripple\ripple_app\node @@ -1605,10 +1605,10 @@ [1] Ripple\ripple_app\_data - + [1] Ripple\ripple_app\node - + [1] Ripple\ripple_app\node diff --git a/modules/ripple_app/node/ripple_HSBELevelDB.cpp b/modules/ripple_app/node/ripple_HSBELevelDB.cpp index d8ad94a42..a6a38a807 100644 --- a/modules/ripple_app/node/ripple_HSBELevelDB.cpp +++ b/modules/ripple_app/node/ripple_HSBELevelDB.cpp @@ -23,7 +23,7 @@ std::string HSBELevelDB::getDataBaseName() return mName; } -bool HSBELevelDB::store(HashedObject::ref obj) +bool HSBELevelDB::store(NodeObject::ref obj) { Blob blob (toBlob (obj)); return mDB->Put (leveldb::WriteOptions (), @@ -31,11 +31,11 @@ bool HSBELevelDB::store(HashedObject::ref obj) leveldb::Slice (reinterpret_cast(&blob.front ()), blob.size ())).ok (); } -bool HSBELevelDB::bulkStore(const std::vector< HashedObject::pointer >& objs) +bool HSBELevelDB::bulkStore(const std::vector< NodeObject::pointer >& objs) { leveldb::WriteBatch batch; - BOOST_FOREACH (HashedObject::ref obj, objs) + BOOST_FOREACH (NodeObject::ref obj, objs) { Blob blob (toBlob (obj)); batch.Put ( @@ -45,18 +45,18 @@ bool HSBELevelDB::bulkStore(const std::vector< HashedObject::pointer >& objs) return mDB->Write (leveldb::WriteOptions (), &batch).ok (); } -HashedObject::pointer HSBELevelDB::retrieve(uint256 const& hash) +NodeObject::pointer HSBELevelDB::retrieve(uint256 const& hash) { std::string sData; if (!mDB->Get (leveldb::ReadOptions (), leveldb::Slice (reinterpret_cast(hash.begin ()), 256 / 8), &sData).ok ()) { - return HashedObject::pointer(); + return NodeObject::pointer(); } return fromBinary(hash, &sData[0], sData.size ()); } -void HSBELevelDB::visitAll(FUNCTION_TYPE func) +void HSBELevelDB::visitAll(FUNCTION_TYPE func) { leveldb::Iterator* it = mDB->NewIterator (leveldb::ReadOptions ()); for (it->SeekToFirst (); it->Valid (); it->Next ()) @@ -70,7 +70,7 @@ void HSBELevelDB::visitAll(FUNCTION_TYPE func) } } -Blob HSBELevelDB::toBlob(HashedObject::ref obj) +Blob HSBELevelDB::toBlob(NodeObject::ref obj) { Blob rawData (9 + obj->getData ().size ()); unsigned char* bufPtr = &rawData.front(); @@ -83,7 +83,7 @@ Blob HSBELevelDB::toBlob(HashedObject::ref obj) return rawData; } -HashedObject::pointer HSBELevelDB::fromBinary(uint256 const& hash, +NodeObject::pointer HSBELevelDB::fromBinary(uint256 const& hash, char const* data, int size) { if (size < 9) @@ -92,6 +92,6 @@ HashedObject::pointer HSBELevelDB::fromBinary(uint256 const& hash, uint32 index = htonl (*reinterpret_cast (data)); int htype = data[8]; - return boost::make_shared (static_cast (htype), index, + return boost::make_shared (static_cast (htype), index, data + 9, size - 9, hash); } diff --git a/modules/ripple_app/node/ripple_HSBELevelDB.h b/modules/ripple_app/node/ripple_HSBELevelDB.h index cc8ba796b..8623ac58d 100644 --- a/modules/ripple_app/node/ripple_HSBELevelDB.h +++ b/modules/ripple_app/node/ripple_HSBELevelDB.h @@ -14,19 +14,19 @@ public: std::string getDataBaseName(); - bool store(HashedObject::ref); - bool bulkStore(const std::vector< HashedObject::pointer >&); + bool store(NodeObject::ref); + bool bulkStore(const std::vector< NodeObject::pointer >&); - HashedObject::pointer retrieve(uint256 const& hash); + NodeObject::pointer retrieve(uint256 const& hash); - void visitAll(FUNCTION_TYPE); + void visitAll(FUNCTION_TYPE); private: std::string mName; leveldb::DB* mDB; - Blob toBlob(HashedObject::ref); - HashedObject::pointer fromBinary(uint256 const& hash, char const* data, int size); + Blob toBlob(NodeObject::ref); + NodeObject::pointer fromBinary(uint256 const& hash, char const* data, int size); }; #endif diff --git a/modules/ripple_app/node/ripple_HSBESqlite.cpp b/modules/ripple_app/node/ripple_HSBESqlite.cpp index 04a3b8b49..368ea9421 100644 --- a/modules/ripple_app/node/ripple_HSBESqlite.cpp +++ b/modules/ripple_app/node/ripple_HSBESqlite.cpp @@ -16,7 +16,7 @@ std::string HSBESQLite::getDataBaseName() return mName; } -bool HSBESQLite::store(HashedObject::ref object) +bool HSBESQLite::store(NodeObject::ref object) { ScopedLock sl(mDb->getDBLock()); static SqliteStatement pSt(mDb->getDB()->getSqliteDB(), @@ -28,7 +28,7 @@ bool HSBESQLite::store(HashedObject::ref object) return true; } -bool HSBESQLite::bulkStore(const std::vector< HashedObject::pointer >& objects) +bool HSBESQLite::bulkStore(const std::vector< NodeObject::pointer >& objects) { ScopedLock sl(mDb->getDBLock()); static SqliteStatement pStB(mDb->getDB()->getSqliteDB(), "BEGIN TRANSACTION;"); @@ -40,7 +40,7 @@ bool HSBESQLite::bulkStore(const std::vector< HashedObject::pointer >& objects) pStB.step(); pStB.reset(); - BOOST_FOREACH(HashedObject::ref object, objects) + BOOST_FOREACH(NodeObject::ref object, objects) { bind(pSt, object); pSt.step(); @@ -54,9 +54,9 @@ bool HSBESQLite::bulkStore(const std::vector< HashedObject::pointer >& objects) } -HashedObject::pointer HSBESQLite::retrieve(uint256 const& hash) +NodeObject::pointer HSBESQLite::retrieve(uint256 const& hash) { - HashedObject::pointer ret; + NodeObject::pointer ret; { ScopedLock sl(mDb->getDBLock()); @@ -66,7 +66,7 @@ HashedObject::pointer HSBESQLite::retrieve(uint256 const& hash) pSt.bind(1, hash.GetHex()); if (pSt.isRow(pSt.step())) - ret = boost::make_shared(getType(pSt.peekString(0)), pSt.getUInt32(1), pSt.getBlob(2), hash); + ret = boost::make_shared(getType(pSt.peekString(0)), pSt.getUInt32(1), pSt.getBlob(2), hash); pSt.reset(); } @@ -74,7 +74,7 @@ HashedObject::pointer HSBESQLite::retrieve(uint256 const& hash) return ret; } -void HSBESQLite::visitAll(FUNCTION_TYPE func) +void HSBESQLite::visitAll(FUNCTION_TYPE func) { uint256 hash; @@ -84,13 +84,13 @@ void HSBESQLite::visitAll(FUNCTION_TYPE func) while (pSt.isRow(pSt.step())) { hash.SetHexExact(pSt.getString(3)); - func(boost::make_shared(getType(pSt.peekString(0)), pSt.getUInt32(1), pSt.getBlob(2), hash)); + func(boost::make_shared(getType(pSt.peekString(0)), pSt.getUInt32(1), pSt.getBlob(2), hash)); } pSt.reset(); } -void HSBESQLite::bind(SqliteStatement& statement, HashedObject::ref object) +void HSBESQLite::bind(SqliteStatement& statement, NodeObject::ref object) { char const* type; switch (object->getType()) @@ -108,9 +108,9 @@ void HSBESQLite::bind(SqliteStatement& statement, HashedObject::ref object) statement.bindStatic(4, object->getData()); } -HashedObjectType HSBESQLite::getType(std::string const& type) +NodeObjectType HSBESQLite::getType(std::string const& type) { - HashedObjectType htype = hotUNKNOWN; + NodeObjectType htype = hotUNKNOWN; if (!type.empty()) { switch (type[0]) diff --git a/modules/ripple_app/node/ripple_HSBESqlite.h b/modules/ripple_app/node/ripple_HSBESqlite.h index 07c6a1706..267f993ef 100644 --- a/modules/ripple_app/node/ripple_HSBESqlite.h +++ b/modules/ripple_app/node/ripple_HSBESqlite.h @@ -14,19 +14,19 @@ public: std::string getDataBaseName(); - bool store(HashedObject::ref); - bool bulkStore(const std::vector< HashedObject::pointer >&); + bool store(NodeObject::ref); + bool bulkStore(const std::vector< NodeObject::pointer >&); - HashedObject::pointer retrieve(uint256 const& hash); + NodeObject::pointer retrieve(uint256 const& hash); - void visitAll(FUNCTION_TYPE); + void visitAll(FUNCTION_TYPE); private: std::string mName; DatabaseCon* mDb; - void bind(SqliteStatement& statement, HashedObject::ref object); - HashedObjectType getType(std::string const&); + void bind(SqliteStatement& statement, NodeObject::ref object); + NodeObjectType getType(std::string const&); }; #endif diff --git a/modules/ripple_app/node/ripple_HashStoreBE.h b/modules/ripple_app/node/ripple_HashStoreBE.h index 770d1003f..7f46598bb 100644 --- a/modules/ripple_app/node/ripple_HashStoreBE.h +++ b/modules/ripple_app/node/ripple_HashStoreBE.h @@ -16,16 +16,16 @@ public: // Store/retrieve a single object // These functions must be thread safe - virtual bool store(HashedObject::ref) = 0; - virtual HashedObject::pointer retrieve(uint256 const &hash) = 0; + virtual bool store(NodeObject::ref) = 0; + virtual NodeObject::pointer retrieve(uint256 const &hash) = 0; // Store a group of objects // This function will only be called from a single thread - virtual bool bulkStore(const std::vector< HashedObject::pointer >&) = 0; + virtual bool bulkStore(const std::vector< NodeObject::pointer >&) = 0; // Visit every object in the database // This function will only be called during an import operation - virtual void visitAll(FUNCTION_TYPE) = 0; + virtual void visitAll(FUNCTION_TYPE) = 0; }; #endif diff --git a/modules/ripple_app/node/ripple_HashedObjectStore.cpp b/modules/ripple_app/node/ripple_HashedObjectStore.cpp index d38f2b3ed..8772db405 100644 --- a/modules/ripple_app/node/ripple_HashedObjectStore.cpp +++ b/modules/ripple_app/node/ripple_HashedObjectStore.cpp @@ -16,7 +16,7 @@ HashedObjectStore::HashedObjectStore (int cacheSize, int cacheAge) : mLevelDB = false; else { - WriteLog (lsFATAL, HashedObject) << "Incorrect database selection"; + WriteLog (lsFATAL, NodeObject) << "Incorrect database selection"; assert (false); } @@ -46,7 +46,7 @@ int HashedObjectStore::getWriteLoad () } // low-level retrieve -HashedObject::pointer HashedObjectStore::LLRetrieve (uint256 const& hash, leveldb::DB* db) +NodeObject::pointer HashedObjectStore::LLRetrieve (uint256 const& hash, leveldb::DB* db) { std::string sData; @@ -56,21 +56,21 @@ HashedObject::pointer HashedObjectStore::LLRetrieve (uint256 const& hash, leveld if (!st.ok ()) { assert (st.IsNotFound ()); - return HashedObject::pointer (); + return NodeObject::pointer (); } const unsigned char* bufPtr = reinterpret_cast (&sData[0]); uint32 index = htonl (*reinterpret_cast (bufPtr)); int htype = bufPtr[8]; - return boost::make_shared (static_cast (htype), index, + return boost::make_shared (static_cast (htype), index, bufPtr + 9, sData.size () - 9, hash); } // low-level write single -void HashedObjectStore::LLWrite (boost::shared_ptr ptr, leveldb::DB* db) +void HashedObjectStore::LLWrite (boost::shared_ptr ptr, leveldb::DB* db) { - HashedObject& obj = *ptr; + NodeObject& obj = *ptr; Blob rawData (9 + obj.getData ().size ()); unsigned char* bufPtr = &rawData.front (); @@ -85,19 +85,19 @@ void HashedObjectStore::LLWrite (boost::shared_ptr ptr, leveldb::D if (!st.ok ()) { - WriteLog (lsFATAL, HashedObject) << "Failed to store hash node"; + WriteLog (lsFATAL, NodeObject) << "Failed to store hash node"; assert (false); } } // low-level write set -void HashedObjectStore::LLWrite (const std::vector< boost::shared_ptr >& set, leveldb::DB* db) +void HashedObjectStore::LLWrite (const std::vector< boost::shared_ptr >& set, leveldb::DB* db) { leveldb::WriteBatch batch; - BOOST_FOREACH (const boost::shared_ptr& it, set) + BOOST_FOREACH (const boost::shared_ptr& it, set) { - const HashedObject& obj = *it; + const NodeObject& obj = *it; Blob rawData (9 + obj.getData ().size ()); unsigned char* bufPtr = &rawData.front (); @@ -114,12 +114,12 @@ void HashedObjectStore::LLWrite (const std::vector< boost::shared_ptr (type, index, data, hash); + NodeObject::pointer object = boost::make_shared (type, index, data, hash); if (!mCache.canonicalize (hash, object)) { @@ -143,7 +143,7 @@ bool HashedObjectStore::storeLevelDB (HashedObjectType type, uint32 index, if (!mWritePending) { mWritePending = true; - getApp().getJobQueue ().addJob (jtWRITE, "HashedObject::store", + getApp().getJobQueue ().addJob (jtWRITE, "NodeObject::store", BIND_TYPE (&HashedObjectStore::bulkWriteLevelDB, this, P_1)); } } @@ -159,7 +159,7 @@ void HashedObjectStore::bulkWriteLevelDB (Job&) while (1) { - std::vector< boost::shared_ptr > set; + std::vector< boost::shared_ptr > set; set.reserve (128); { @@ -188,9 +188,9 @@ void HashedObjectStore::bulkWriteLevelDB (Job&) } } -HashedObject::pointer HashedObjectStore::retrieveLevelDB (uint256 const& hash) +NodeObject::pointer HashedObjectStore::retrieveLevelDB (uint256 const& hash) { - HashedObject::pointer obj = mCache.fetch (hash); + NodeObject::pointer obj = mCache.fetch (hash); if (obj || mNegativeCache.isPresent (hash) || !getApp().getHashNodeLDB ()) return obj; @@ -222,46 +222,46 @@ HashedObject::pointer HashedObjectStore::retrieveLevelDB (uint256 const& hash) if (mEphemeralDB) LLWrite (obj, getApp().getEphemeralLDB ()); - WriteLog (lsTRACE, HashedObject) << "HOS: " << hash << " fetch: in db"; + WriteLog (lsTRACE, NodeObject) << "HOS: " << hash << " fetch: in db"; return obj; } -bool HashedObjectStore::storeSQLite (HashedObjectType type, uint32 index, +bool HashedObjectStore::storeSQLite (NodeObjectType type, uint32 index, Blob const& data, uint256 const& hash) { // return: false = already in cache, true = added to cache if (!getApp().getHashNodeDB ()) { - WriteLog (lsTRACE, HashedObject) << "HOS: no db"; + WriteLog (lsTRACE, NodeObject) << "HOS: no db"; return true; } if (mCache.touch (hash)) { - WriteLog (lsTRACE, HashedObject) << "HOS: " << hash << " store: incache"; + WriteLog (lsTRACE, NodeObject) << "HOS: " << hash << " store: incache"; return false; } assert (hash == Serializer::getSHA512Half (data)); - HashedObject::pointer object = boost::make_shared (type, index, data, hash); + NodeObject::pointer object = boost::make_shared (type, index, data, hash); if (!mCache.canonicalize (hash, object)) { - // WriteLog (lsTRACE, HashedObject) << "Queuing write for " << hash; + // WriteLog (lsTRACE, NodeObject) << "Queuing write for " << hash; boost::mutex::scoped_lock sl (mWriteMutex); mWriteSet.push_back (object); if (!mWritePending) { mWritePending = true; - getApp().getJobQueue ().addJob (jtWRITE, "HashedObject::store", + getApp().getJobQueue ().addJob (jtWRITE, "NodeObject::store", BIND_TYPE (&HashedObjectStore::bulkWriteSQLite, this, P_1)); } } // else - // WriteLog (lsTRACE, HashedObject) << "HOS: already had " << hash; + // WriteLog (lsTRACE, NodeObject) << "HOS: already had " << hash; mNegativeCache.del (hash); return true; @@ -274,7 +274,7 @@ void HashedObjectStore::bulkWriteSQLite (Job&) while (1) { - std::vector< boost::shared_ptr > set; + std::vector< boost::shared_ptr > set; set.reserve (128); { @@ -294,7 +294,7 @@ void HashedObjectStore::bulkWriteSQLite (Job&) mWriteLoad = std::max (setSize, static_cast (mWriteSet.size ())); setSize = set.size (); } - // WriteLog (lsTRACE, HashedObject) << "HOS: writing " << set.size(); + // WriteLog (lsTRACE, NodeObject) << "HOS: writing " << set.size(); #ifndef NO_SQLITE3_PREPARE @@ -316,7 +316,7 @@ void HashedObjectStore::bulkWriteSQLite (Job&) pStB.step (); pStB.reset (); - BOOST_FOREACH (const boost::shared_ptr& it, set) + BOOST_FOREACH (const boost::shared_ptr& it, set) { const char* type; @@ -350,7 +350,7 @@ void HashedObjectStore::bulkWriteSQLite (Job&) if (!pSt.isDone (ret)) { - WriteLog (lsFATAL, HashedObject) << "Error saving hashed object " << ret; + WriteLog (lsFATAL, NodeObject) << "Error saving hashed object " << ret; assert (false); } @@ -373,7 +373,7 @@ void HashedObjectStore::bulkWriteSQLite (Job&) db->executeSQL ("BEGIN TRANSACTION;"); - BOOST_FOREACH (const boost::shared_ptr& it, set) + BOOST_FOREACH (const boost::shared_ptr& it, set) { char type; @@ -410,9 +410,9 @@ void HashedObjectStore::bulkWriteSQLite (Job&) } } -HashedObject::pointer HashedObjectStore::retrieveSQLite (uint256 const& hash) +NodeObject::pointer HashedObjectStore::retrieveSQLite (uint256 const& hash) { - HashedObject::pointer obj = mCache.fetch (hash); + NodeObject::pointer obj = mCache.fetch (hash); if (obj) return obj; @@ -452,7 +452,7 @@ HashedObject::pointer HashedObjectStore::retrieveSQLite (uint256 const& hash) { pSt.reset (); mNegativeCache.add (hash); - WriteLog (lsTRACE, HashedObject) << "HOS: " << hash << " fetch: not in db"; + WriteLog (lsTRACE, NodeObject) << "HOS: " << hash << " fetch: not in db"; return obj; } @@ -494,7 +494,7 @@ HashedObject::pointer HashedObjectStore::retrieveSQLite (uint256 const& hash) assert (Serializer::getSHA512Half (data) == hash); #endif - HashedObjectType htype = hotUNKNOWN; + NodeObjectType htype = hotUNKNOWN; switch (type[0]) { @@ -516,24 +516,24 @@ HashedObject::pointer HashedObjectStore::retrieveSQLite (uint256 const& hash) default: assert (false); - WriteLog (lsERROR, HashedObject) << "Invalid hashed object"; + WriteLog (lsERROR, NodeObject) << "Invalid hashed object"; mNegativeCache.add (hash); return obj; } - obj = boost::make_shared (htype, index, data, hash); + obj = boost::make_shared (htype, index, data, hash); mCache.canonicalize (hash, obj); if (mEphemeralDB) LLWrite (obj, getApp().getEphemeralLDB ()); - WriteLog (lsTRACE, HashedObject) << "HOS: " << hash << " fetch: in db"; + WriteLog (lsTRACE, NodeObject) << "HOS: " << hash << " fetch: in db"; return obj; } int HashedObjectStore::import (const std::string& file) { - WriteLog (lsWARNING, HashedObject) << "Hashed object import from \"" << file << "\"."; + WriteLog (lsWARNING, NodeObject) << "Hashed object import from \"" << file << "\"."; UPTR_T importDB (new SqliteDatabase (file.c_str ())); importDB->connect (); @@ -551,7 +551,7 @@ int HashedObjectStore::import (const std::string& file) if (hash.isZero ()) { - WriteLog (lsWARNING, HashedObject) << "zero hash found in import table"; + WriteLog (lsWARNING, NodeObject) << "zero hash found in import table"; } else { @@ -568,7 +568,7 @@ int HashedObjectStore::import (const std::string& file) std::string type; importDB->getStr ("ObjType", type); - HashedObjectType htype = hotUNKNOWN; + NodeObjectType htype = hotUNKNOWN; switch (type[0]) { @@ -590,7 +590,7 @@ int HashedObjectStore::import (const std::string& file) default: assert (false); - WriteLog (lsERROR, HashedObject) << "Invalid hashed object"; + WriteLog (lsERROR, NodeObject) << "Invalid hashed object"; } * (bufPtr + 8) = static_cast (htype); @@ -601,7 +601,7 @@ int HashedObjectStore::import (const std::string& file) if (!st.ok ()) { - WriteLog (lsFATAL, HashedObject) << "Failed to store hash node"; + WriteLog (lsFATAL, NodeObject) << "Failed to store hash node"; assert (false); } @@ -610,11 +610,11 @@ int HashedObjectStore::import (const std::string& file) if ((count % 10000) == 0) { - WriteLog (lsINFO, HashedObject) << "Import in progress: " << count; + WriteLog (lsINFO, NodeObject) << "Import in progress: " << count; } } - WriteLog (lsWARNING, HashedObject) << "Imported " << count << " nodes"; + WriteLog (lsWARNING, NodeObject) << "Imported " << count << " nodes"; return count; } diff --git a/modules/ripple_app/node/ripple_HashedObjectStore.h b/modules/ripple_app/node/ripple_HashedObjectStore.h index 53ce5e5a4..d27816ba7 100644 --- a/modules/ripple_app/node/ripple_HashedObjectStore.h +++ b/modules/ripple_app/node/ripple_HashedObjectStore.h @@ -25,7 +25,7 @@ public: return mCache.getHitRate (); } - bool store (HashedObjectType type, uint32 index, Blob const& data, + bool store (NodeObjectType type, uint32 index, Blob const& data, uint256 const& hash) { if (mLevelDB) @@ -34,7 +34,7 @@ public: return storeSQLite (type, index, data, hash); } - HashedObject::pointer retrieve (uint256 const& hash) + NodeObject::pointer retrieve (uint256 const& hash) { if (mLevelDB) return retrieveLevelDB (hash); @@ -42,14 +42,14 @@ public: return retrieveSQLite (hash); } - bool storeSQLite (HashedObjectType type, uint32 index, Blob const& data, + bool storeSQLite (NodeObjectType type, uint32 index, Blob const& data, uint256 const& hash); - HashedObject::pointer retrieveSQLite (uint256 const& hash); + NodeObject::pointer retrieveSQLite (uint256 const& hash); void bulkWriteSQLite (Job&); - bool storeLevelDB (HashedObjectType type, uint32 index, Blob const& data, + bool storeLevelDB (NodeObjectType type, uint32 index, Blob const& data, uint256 const& hash); - HashedObject::pointer retrieveLevelDB (uint256 const& hash); + NodeObject::pointer retrieveLevelDB (uint256 const& hash); void bulkWriteLevelDB (Job&); @@ -65,12 +65,12 @@ public: int import (const std::string& fileName); private: - static HashedObject::pointer LLRetrieve (uint256 const& hash, leveldb::DB* db); - static void LLWrite (boost::shared_ptr ptr, leveldb::DB* db); - static void LLWrite (const std::vector< boost::shared_ptr >& set, leveldb::DB* db); + static NodeObject::pointer LLRetrieve (uint256 const& hash, leveldb::DB* db); + static void LLWrite (boost::shared_ptr ptr, leveldb::DB* db); + static void LLWrite (const std::vector< boost::shared_ptr >& set, leveldb::DB* db); private: - TaggedCache mCache; + TaggedCache mCache; KeyCache mNegativeCache; boost::mutex mWriteMutex; @@ -78,7 +78,7 @@ private: int mWriteGeneration; int mWriteLoad; - std::vector< boost::shared_ptr > mWriteSet; + std::vector< boost::shared_ptr > mWriteSet; bool mWritePending; bool mLevelDB; bool mEphemeralDB; diff --git a/modules/ripple_app/node/ripple_HashedObject.cpp b/modules/ripple_app/node/ripple_NodeObject.cpp similarity index 72% rename from modules/ripple_app/node/ripple_HashedObject.cpp rename to modules/ripple_app/node/ripple_NodeObject.cpp index 1efc6b739..ac8bce22e 100644 --- a/modules/ripple_app/node/ripple_HashedObject.cpp +++ b/modules/ripple_app/node/ripple_NodeObject.cpp @@ -4,10 +4,10 @@ */ //============================================================================== -SETUP_LOG (HashedObject) +SETUP_LOG (NodeObject) -HashedObject::HashedObject ( - HashedObjectType type, +NodeObject::NodeObject ( + NodeObjectType type, LedgerIndex ledgerIndex, Blob const& binaryDataToCopy, uint256 const& hash) @@ -18,8 +18,8 @@ HashedObject::HashedObject ( { } -HashedObject::HashedObject ( - HashedObjectType type, +NodeObject::NodeObject ( + NodeObjectType type, LedgerIndex ledgerIndex, void const* bufferToCopy, int bytesInBuffer, @@ -32,22 +32,22 @@ HashedObject::HashedObject ( { } -HashedObjectType HashedObject::getType () const +NodeObjectType NodeObject::getType () const { return mType; } -uint256 const& HashedObject::getHash () const +uint256 const& NodeObject::getHash () const { return mHash; } -LedgerIndex HashedObject::getIndex () const +LedgerIndex NodeObject::getIndex () const { return mLedgerIndex; } -Blob const& HashedObject::getData () const +Blob const& NodeObject::getData () const { return mData; } diff --git a/modules/ripple_app/node/ripple_HashedObject.h b/modules/ripple_app/node/ripple_NodeObject.h similarity index 83% rename from modules/ripple_app/node/ripple_HashedObject.h rename to modules/ripple_app/node/ripple_NodeObject.h index 0134af07d..2a5444864 100644 --- a/modules/ripple_app/node/ripple_HashedObject.h +++ b/modules/ripple_app/node/ripple_NodeObject.h @@ -9,7 +9,7 @@ /** The types of hashed objects. */ -enum HashedObjectType +enum NodeObjectType { hotUNKNOWN = 0, hotLEDGER = 1, @@ -32,20 +32,20 @@ enum HashedObjectType // VFALCO TODO consider making the instance a private member of SHAMap // since its the primary user. // -class HashedObject - : public CountedObject +class NodeObject + : public CountedObject { public: - static char const* getCountedObjectName () { return "HashedObject"; } + static char const* getCountedObjectName () { return "NodeObject"; } - typedef boost::shared_ptr pointer; + typedef boost::shared_ptr pointer; typedef pointer const& ref; /** Create from a vector of data. @note A copy of the data is created. */ - HashedObject (HashedObjectType type, + NodeObject (NodeObjectType type, LedgerIndex ledgerIndex, Blob const & binaryDataToCopy, uint256 const & hash); @@ -54,7 +54,7 @@ public: @note A copy of the data is created. */ - HashedObject (HashedObjectType type, + NodeObject (NodeObjectType type, LedgerIndex ledgerIndex, void const * bufferToCopy, int bytesInBuffer, @@ -62,7 +62,7 @@ public: /** Retrieve the type of this object. */ - HashedObjectType getType () const; + NodeObjectType getType () const; /** Retrieve the hash metadata. */ @@ -78,7 +78,7 @@ public: Blob const& getData () const; private: - HashedObjectType const mType; + NodeObjectType const mType; uint256 const mHash; LedgerIndex const mLedgerIndex; Blob const mData; diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index c97fd52ce..5e3f5fb45 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -94,7 +94,7 @@ namespace ripple #include "src/cpp/ripple/ripple_SqliteDatabase.h" #include "src/cpp/ripple/ripple_DBInit.h" -#include "node/ripple_HashedObject.h" +#include "node/ripple_NodeObject.h" #include "node/ripple_HashedObjectStore.h" #include "node/ripple_HashStoreBE.h" #include "node/ripple_HSBELevelDB.h" @@ -235,7 +235,7 @@ static const uint64 tenTo17m1 = tenTo17 - 1; #if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 1 #include "basics/ripple_RPCServerHandler.cpp" -#include "node/ripple_HashedObject.cpp" +#include "node/ripple_NodeObject.cpp" #include "node/ripple_HashedObjectStore.cpp" #include "node/ripple_HSBELevelDB.cpp" #include "node/ripple_HSBESqlite.cpp" diff --git a/src/cpp/ripple/ripple_InboundLedger.cpp b/src/cpp/ripple/ripple_InboundLedger.cpp index 0eaf36af9..8f749ba1b 100644 --- a/src/cpp/ripple/ripple_InboundLedger.cpp +++ b/src/cpp/ripple/ripple_InboundLedger.cpp @@ -49,7 +49,7 @@ bool InboundLedger::tryLocal () if (!mHaveBase) { // Nothing we can do without the ledger base - HashedObject::pointer node = getApp().getHashedObjectStore ().retrieve (mHash); + NodeObject::pointer node = getApp().getHashedObjectStore ().retrieve (mHash); if (!node) { diff --git a/src/cpp/ripple/ripple_Peer.cpp b/src/cpp/ripple/ripple_Peer.cpp index 8e464ab4a..062e362a9 100644 --- a/src/cpp/ripple/ripple_Peer.cpp +++ b/src/cpp/ripple/ripple_Peer.cpp @@ -1535,7 +1535,7 @@ void PeerImp::recvGetObjectByHash (const boost::shared_ptr disarmDirty (); void setSeq (uint32 seq)