20 #include <ripple/basics/Log.h>
21 #include <ripple/basics/contract.h>
22 #include <ripple/core/DatabaseCon.h>
23 #include <ripple/core/SociDB.h>
25 #include <boost/algorithm/string.hpp>
26 #include <boost/format.hpp>
115 Throw<std::runtime_error>(
"database_path must be set.");
121 auto const& sqlite = c.
section(
"sqlite");
122 auto result = std::make_unique<std::vector<std::string>>();
130 bool showRiskWarning =
false;
132 if (
set(safety_level,
"safety_level", sqlite))
134 if (boost::iequals(safety_level,
"low"))
137 journal_mode =
"memory";
139 temp_store =
"memory";
140 showRiskWarning =
true;
142 else if (!boost::iequals(safety_level,
"high"))
144 Throw<std::runtime_error>(
145 "Invalid safety_level value: " + safety_level);
152 if (
set(journal_mode,
"journal_mode", sqlite) &&
153 !safety_level.
empty())
155 Throw<std::runtime_error>(
156 "Configuration file may not define both "
157 "\"safety_level\" and \"journal_mode\"");
159 bool higherRisk = boost::iequals(journal_mode,
"memory") ||
160 boost::iequals(journal_mode,
"off");
161 showRiskWarning = showRiskWarning || higherRisk;
162 if (higherRisk || boost::iequals(journal_mode,
"delete") ||
163 boost::iequals(journal_mode,
"truncate") ||
164 boost::iequals(journal_mode,
"persist") ||
165 boost::iequals(journal_mode,
"wal"))
167 result->emplace_back(boost::str(
172 Throw<std::runtime_error>(
173 "Invalid journal_mode value: " + journal_mode);
179 if (
set(synchronous,
"synchronous", sqlite) &&
180 !safety_level.
empty())
182 Throw<std::runtime_error>(
183 "Configuration file may not define both "
184 "\"safety_level\" and \"synchronous\"");
186 bool higherRisk = boost::iequals(synchronous,
"off");
187 showRiskWarning = showRiskWarning || higherRisk;
188 if (higherRisk || boost::iequals(synchronous,
"normal") ||
189 boost::iequals(synchronous,
"full") ||
190 boost::iequals(synchronous,
"extra"))
192 result->emplace_back(boost::str(
197 Throw<std::runtime_error>(
198 "Invalid synchronous value: " + synchronous);
204 if (
set(temp_store,
"temp_store", sqlite) &&
205 !safety_level.
empty())
207 Throw<std::runtime_error>(
208 "Configuration file may not define both "
209 "\"safety_level\" and \"temp_store\"");
211 bool higherRisk = boost::iequals(temp_store,
"memory");
212 showRiskWarning = showRiskWarning || higherRisk;
213 if (higherRisk || boost::iequals(temp_store,
"default") ||
214 boost::iequals(temp_store,
"file"))
216 result->emplace_back(boost::str(
221 Throw<std::runtime_error>(
222 "Invalid temp_store value: " + temp_store);
229 <<
"reducing the data integrity guarantees from the "
230 "default [sqlite] behavior is not recommended for "
231 "nodes storing large amounts of history, because of the "
232 "difficulty inherent in rebuilding corrupted data.";
234 assert(result->size() == 3);
250 Throw<std::logic_error>(
"No JobQueue");