BasicConfig support for legacy values:

* A legacy value is a config section with a single-line.
* These values may be read from the BasicConfig interface so
  the deprecated Config class does not need to be exposed to
  clients.
* Made Config class more testable.
This commit is contained in:
seelabs
2015-02-03 12:03:39 -08:00
committed by Tom Ritchford
parent b11ad375cd
commit 617d84c0ef
13 changed files with 691 additions and 317 deletions

View File

@@ -87,10 +87,10 @@ struct SizedItem
int sizes[5];
};
// VFALCO NOTE This entire derived class is deprecated
// For new config information use the style implied
// in the base class. For existing config information
// try to refactor code to use the new style.
// This entire derived class is deprecated.
// For new config information use the style implied
// in the base class. For existing config information
// try to refactor code to use the new style.
//
class Config : public BasicConfig
{
@@ -121,20 +121,17 @@ public:
/** Returns the directory from which the configuration file was loaded. */
beast::File getConfigDir () const;
/** Returns the directory in which the current database files are located. */
beast::File getDatabaseDir () const;
/** Returns the full path and filename of the debug log file. */
boost::filesystem::path getDebugLogFile () const;
// LEGACY FIELDS, REMOVE ASAP
// DEPRECATED
boost::filesystem::path CONFIG_FILE; // used by UniqueNodeList
private:
boost::filesystem::path CONFIG_DIR;
boost::filesystem::path DEBUG_LOGFILE;
void load ();
public:
// VFALCO TODO Make this private and fix callers to go through getDatabaseDir()
boost::filesystem::path DATA_DIR;
//--------------------------------------------------------------------------
@@ -152,10 +149,6 @@ public:
/** List of Validators entries from rippled.cfg */
std::vector <std::string> validators;
private:
/** The folder where new module databases should be located */
beast::File m_moduleDbPath;
public:
//--------------------------------------------------------------------------
/** Returns the location were databases should be located
@@ -164,7 +157,7 @@ public:
stored in a file named after the module (e.g. "peerfinder.sqlite") that
is inside that directory.
*/
beast::File const& getModuleDatabasePath ();
beast::File getModuleDatabasePath () const;
//--------------------------------------------------------------------------
@@ -234,9 +227,6 @@ public:
std::string START_LEDGER;
// Database
std::string DATABASE_PATH;
// Network parameters
int TRANSACTION_FEE_BASE; // The number of fee units a reference transaction costs
@@ -312,10 +302,16 @@ public:
int getSize (SizedItemName) const;
void setup (std::string const& strConf, bool bQuiet);
void load ();
/**
* Load the conig from the contents of the sting.
*
* @param fileContents String representing the config contents.
*/
void loadFromString (std::string const& fileContents);
};
// VFALCO DEPRECATED
// DEPRECATED
extern Config& getConfig();
} // ripple