diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 693df7d7e..d8ce6722a 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -1758,14 +1758,6 @@ - - True - True - ..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories) - ..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories) - - - True True diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index 36a4bde1e..49a9252a3 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -283,9 +283,6 @@ {815DC1A2-E2EF-E6E3-D979-19AD1476A28B} - - {0FCD3973-E9A6-7172-C8A3-C3401E1A03DD} - {03533509-DAC6-636F-9F7E-288894549E95} @@ -2409,12 +2406,6 @@ ripple\app\misc - - ripple\app\node - - - ripple\app\node - ripple\app\paths diff --git a/src/ripple/app/node/SqliteFactory.cpp b/src/ripple/app/node/SqliteFactory.cpp deleted file mode 100644 index c5f3e7ab5..000000000 --- a/src/ripple/app/node/SqliteFactory.cpp +++ /dev/null @@ -1,263 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include -#include -#include -#include -#include -#include // - -namespace ripple { - -// VFALCO NOTE LedgerIndex in CommittedObjects is obsolete - -static const char* s_nodeStoreDBInit [] = -{ - "PRAGMA synchronous=NORMAL;", - "PRAGMA journal_mode=WAL;", - "PRAGMA journal_size_limit=1582080;", - -#if (ULONG_MAX > UINT_MAX) && !defined (NO_SQLITE_MMAP) - "PRAGMA mmap_size=171798691840;", -#endif - - "BEGIN TRANSACTION;", - - "CREATE TABLE CommittedObjects ( \ - Hash CHARACTER(64) PRIMARY KEY, \ - ObjType CHAR(1) NOT NULL, \ - LedgerIndex BIGINT UNSIGNED, \ - Object BLOB \ - );", - - "END TRANSACTION;" -}; - -//------------------------------------------------------------------------------ - -class SqliteBackend : public NodeStore::Backend -{ -public: - explicit SqliteBackend (std::string const& path, int hashnode_cache_size) - : m_name (path) - , m_db (new DatabaseCon(setup_DatabaseCon (getConfig()), path, - s_nodeStoreDBInit, std::extent::value)) - { - std::string s ("PRAGMA cache_size=-"); - s += std::to_string (hashnode_cache_size); - m_db->getDB()->executeSQL (s); - } - - ~SqliteBackend() - { - } - - std::string getName() - { - return m_name; - } - - void - close() override - { - // VFALCO how do we do this? - assert(false); - } - - //-------------------------------------------------------------------------- - - NodeStore::Status fetch (void const* key, NodeObject::Ptr* pObject) - { - NodeStore::Status result = NodeStore::ok; - - pObject->reset (); - - { - auto sl (m_db->lock()); - - uint256 const hash (uint256::fromVoid (key)); - - static SqliteStatement pSt (m_db->getDB()->getSqliteDB(), - "SELECT ObjType,Object FROM CommittedObjects WHERE Hash = ?;"); - - pSt.bind (1, to_string (hash)); - - if (pSt.isRow (pSt.step())) - { - // VFALCO NOTE This is unfortunately needed, - // the DatabaseCon creates the blob? - Blob data (pSt.getBlob(1)); - *pObject = NodeObject::createObject ( - getTypeFromString (pSt.peekString (0)), - std::move(data), - hash); - } - else - { - result = NodeStore::notFound; - } - - pSt.reset(); - } - - return result; - } - - void store (NodeObject::ref object) - { - NodeStore::Batch batch; - - batch.push_back (object); - - storeBatch (batch); - } - - void storeBatch (NodeStore::Batch const& batch) - { - auto sl (m_db->lock()); - - static SqliteStatement pStB (m_db->getDB()->getSqliteDB(), "BEGIN TRANSACTION;"); - static SqliteStatement pStE (m_db->getDB()->getSqliteDB(), "END TRANSACTION;"); - static SqliteStatement pSt (m_db->getDB()->getSqliteDB(), - "INSERT OR IGNORE INTO CommittedObjects " - "(Hash,ObjType,Object) VALUES (?, ?, ?, ?);"); - - pStB.step(); - pStB.reset(); - - for (NodeObject::Ptr const& object : batch) - { - doBind (pSt, object); - - pSt.step(); - pSt.reset(); - } - - pStE.step(); - pStE.reset(); - } - - void for_each (std::function f) - { - // No lock needed as per the for_each() API - - uint256 hash; - - static SqliteStatement pSt(m_db->getDB()->getSqliteDB(), - "SELECT ObjType,Object,Hash FROM CommittedObjects;"); - - while (pSt.isRow (pSt.step())) - { - hash.SetHexExact(pSt.getString(3)); - - // VFALCO NOTE This is unfortunately needed, - // the DatabaseCon creates the blob? - Blob data (pSt.getBlob (1)); - NodeObject::Ptr const object (NodeObject::createObject ( - getTypeFromString (pSt.peekString (0)), - std::move(data), - hash)); - - f (object); - } - - pSt.reset (); - } - - int getWriteLoad () - { - return 0; - } - - void setDeletePath() override {} - - //-------------------------------------------------------------------------- - - void doBind (SqliteStatement& statement, NodeObject::ref object) - { - char const* type; - switch (object->getType()) - { - case hotLEDGER: type = "L"; break; - case hotTRANSACTION: type = "T"; break; - case hotACCOUNT_NODE: type = "A"; break; - case hotTRANSACTION_NODE: type = "N"; break; - default: type = "U"; - } - - statement.bind(1, to_string (object->getHash())); - statement.bind(2, type); - statement.bindStatic(3, object->getData()); - } - - NodeObjectType getTypeFromString (std::string const& s) - { - NodeObjectType type = hotUNKNOWN; - - if (!s.empty ()) - { - switch (s [0]) - { - case 'L': type = hotLEDGER; break; - case 'T': type = hotTRANSACTION; break; - case 'A': type = hotACCOUNT_NODE; break; - case 'N': type = hotTRANSACTION_NODE; break; - } - } - return type; - } - - void - verify() override - { - } - -private: - std::string const m_name; - std::unique_ptr m_db; -}; - -//------------------------------------------------------------------------------ - -class SqliteFactory : public NodeStore::Factory -{ -public: - SqliteFactory() = default; - - std::string - getName () const - { - return "Sqlite"; - } - - std::unique_ptr createInstance ( - size_t, Section const& keyValues, - NodeStore::Scheduler&, beast::Journal) - { - return std::make_unique ( - get(keyValues, "path"), - getConfig ().getSize(siHashNodeDBCache) * 1024); - } -}; - -static SqliteFactory sqliteFactory; - -} diff --git a/src/ripple/app/node/SqliteFactory.h b/src/ripple/app/node/SqliteFactory.h deleted file mode 100644 index 613ab2f46..000000000 --- a/src/ripple/app/node/SqliteFactory.h +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_APP_NODE_SQLITEFACTORY_H_INCLUDED -#define RIPPLE_APP_NODE_SQLITEFACTORY_H_INCLUDED - -#include - -namespace ripple { - -/** Factory to produce SQLite backends for the NodeStore. - @see Database -*/ -std::unique_ptr make_SqliteFactory (int hashnode_cache_size); - -} - -#endif diff --git a/src/ripple/unity/app.cpp b/src/ripple/unity/app.cpp index d92b40509..e8e7ea960 100644 --- a/src/ripple/unity/app.cpp +++ b/src/ripple/unity/app.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include