From a7598c56102ef751ba6dd144bf804d6ff9bfc5f9 Mon Sep 17 00:00:00 2001 From: seelabs Date: Fri, 17 Apr 2015 06:55:23 -0700 Subject: [PATCH] Remove unused database table (RIPD-755) --- src/ripple/app/data/DBInit.cpp | 13 -------- src/ripple/app/data/DBInit.h | 2 -- src/ripple/app/main/Application.cpp | 10 ------ src/ripple/app/main/Application.h | 1 - src/ripple/app/main/LocalCredentials.cpp | 40 ------------------------ src/ripple/app/main/LocalCredentials.h | 7 ----- 6 files changed, 73 deletions(-) diff --git a/src/ripple/app/data/DBInit.cpp b/src/ripple/app/data/DBInit.cpp index c7c43e05f..74fb159e8 100644 --- a/src/ripple/app/data/DBInit.cpp +++ b/src/ripple/app/data/DBInit.cpp @@ -106,19 +106,6 @@ const char* LedgerDBInit[] = int LedgerDBCount = std::extent::value; -// RPC database holds persistent data for RPC clients. -const char* RpcDBInit[] = -{ - - // Local persistence of the RPC client - "CREATE TABLE IF NOT EXISTS RPCData ( \ - Key TEXT PRIMARY Key, \ - Value TEXT \ - );", -}; - -int RpcDBCount = std::extent::value; - // NodeIdentity database holds local accounts and trusted nodes // VFALCO NOTE but its a table not a database, so...? // diff --git a/src/ripple/app/data/DBInit.h b/src/ripple/app/data/DBInit.h index f069afc15..9ff2d071f 100644 --- a/src/ripple/app/data/DBInit.h +++ b/src/ripple/app/data/DBInit.h @@ -23,13 +23,11 @@ namespace ripple { // VFALCO TODO Tidy these up into a class with functions and return types. -extern const char* RpcDBInit[]; extern const char* TxnDBInit[]; extern const char* LedgerDBInit[]; extern const char* WalletDBInit[]; // VFALCO TODO Figure out what these counts are for -extern int RpcDBCount; extern int TxnDBCount; extern int LedgerDBCount; extern int WalletDBCount; diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index cd3a2f677..d417c5244 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -289,7 +289,6 @@ public: beast::DeadlineTimer m_sweepTimer; beast::DeadlineTimer m_entropyTimer; - std::unique_ptr mRpcDB; std::unique_ptr mTxnDB; std::unique_ptr mLedgerDB; std::unique_ptr mWalletDB; @@ -607,11 +606,6 @@ public: return m_sntpClient->getOffset (offset); } - DatabaseCon& getRpcDB () - { - assert (mRpcDB.get() != nullptr); - return *mRpcDB; - } DatabaseCon& getTxnDB () { assert (mTxnDB.get() != nullptr); @@ -637,14 +631,11 @@ public: //-------------------------------------------------------------------------- bool initSqliteDbs () { - assert (mRpcDB.get () == nullptr); assert (mTxnDB.get () == nullptr); assert (mLedgerDB.get () == nullptr); assert (mWalletDB.get () == nullptr); DatabaseCon::Setup setup = setup_DatabaseCon (getConfig()); - mRpcDB = std::make_unique (setup, "rpc.db", RpcDBInit, - RpcDBCount); mTxnDB = std::make_unique (setup, "transaction.db", TxnDBInit, TxnDBCount); mLedgerDB = std::make_unique (setup, "ledger.db", @@ -653,7 +644,6 @@ public: WalletDBInit, WalletDBCount); return - mRpcDB.get() != nullptr && mTxnDB.get () != nullptr && mLedgerDB.get () != nullptr && mWalletDB.get () != nullptr; diff --git a/src/ripple/app/main/Application.h b/src/ripple/app/main/Application.h index 38c820552..830778f99 100644 --- a/src/ripple/app/main/Application.h +++ b/src/ripple/app/main/Application.h @@ -115,7 +115,6 @@ public: virtual PathRequests& getPathRequests () = 0; virtual SHAMapStore& getSHAMapStore () = 0; - virtual DatabaseCon& getRpcDB () = 0; virtual DatabaseCon& getTxnDB () = 0; virtual DatabaseCon& getLedgerDB () = 0; diff --git a/src/ripple/app/main/LocalCredentials.cpp b/src/ripple/app/main/LocalCredentials.cpp index 2a9b88262..25ff7d5c0 100644 --- a/src/ripple/app/main/LocalCredentials.cpp +++ b/src/ripple/app/main/LocalCredentials.cpp @@ -116,44 +116,4 @@ bool LocalCredentials::nodeIdentityCreate () return true; } -bool LocalCredentials::dataDelete (std::string const& strKey) -{ - auto db = getApp().getRpcDB ().checkoutDb (); - - *db << (str (boost::format ("DELETE FROM RPCData WHERE Key=%s;") - % sqlEscape (strKey))); - return true; -} - -bool LocalCredentials::dataFetch (std::string const& strKey, std::string& strValue) -{ - auto db = getApp().getRpcDB ().checkoutDb (); - - bool bSuccess = false; - - soci::blob value (*db); - soci::indicator vi; - *db << str (boost::format ("SELECT Value FROM RPCData WHERE Key=%s;") - % sqlEscape (strKey)), - soci::into(value, vi); - - if (soci::i_ok == vi) - { - convert (value, strValue); - bSuccess = true; - } - - return bSuccess; -} - -bool LocalCredentials::dataStore (std::string const& strKey, std::string const& strValue) -{ - auto db = getApp().getRpcDB ().checkoutDb (); - - *db << (str (boost::format ("REPLACE INTO RPCData (Key, Value) VALUES (%s,%s);") - % sqlEscape (strKey) - % sqlEscape (strValue))); - return true; -} - } // ripple diff --git a/src/ripple/app/main/LocalCredentials.h b/src/ripple/app/main/LocalCredentials.h index 955000a3b..1e4cea663 100644 --- a/src/ripple/app/main/LocalCredentials.h +++ b/src/ripple/app/main/LocalCredentials.h @@ -48,13 +48,6 @@ public: return mNodePrivateKey; } - // Local persistence of RPC clients - bool dataDelete (std::string const& strKey); - - // VFALCO NOTE why is strValue non-const? - bool dataFetch (std::string const& strKey, std::string& strValue); - bool dataStore (std::string const& strKey, std::string const& strValue); - private: bool nodeIdentityLoad (); bool nodeIdentityCreate ();