MCPcopy Create free account
hub / github.com/apple/foundationdb / loadIniFile

Method loadIniFile

fdbserver/SimulatedCluster.actor.cpp:197–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195 }
196
197 void loadIniFile(const char* testFile) {
198 std::ifstream ifs;
199 ifs.open(testFile, std::ifstream::in);
200 if (!ifs.good())
201 return;
202
203 std::string cline;
204
205 while (ifs.good()) {
206 getline(ifs, cline);
207 std::string line = removeWhitespace(std::string(cline));
208 if (!line.size() || line.find(';') == 0)
209 continue;
210
211 size_t found = line.find('=');
212 if (found == std::string::npos)
213 // hmmm, not good
214 continue;
215 std::string attrib = removeWhitespace(line.substr(0, found));
216 std::string value = removeWhitespace(line.substr(found + 1));
217
218 if (attrib == "extraDatabaseMode") {
219 extraDatabaseMode = ISimulator::stringToExtraDatabaseMode(value);
220 }
221
222 if (attrib == "extraDatabaseCount") {
223 sscanf(value.c_str(), "%d", &extraDatabaseCount);
224 }
225
226 if (attrib == "minimumReplication") {
227 sscanf(value.c_str(), "%d", &minimumReplication);
228 }
229
230 if (attrib == "minimumRegions") {
231 sscanf(value.c_str(), "%d", &minimumRegions);
232 }
233
234 if (attrib == "configureLocked") {
235 int configureLockedInt;
236 sscanf(value.c_str(), "%d", &configureLockedInt);
237 configureLocked = (configureLockedInt != 0);
238 }
239
240 if (attrib == "startIncompatibleProcess") {
241 startIncompatibleProcess = strcmp(value.c_str(), "true") == 0;
242 }
243
244 if (attrib == "logAntiQuorum") {
245 sscanf(value.c_str(), "%d", &logAntiQuorum);
246 }
247
248 if (attrib == "storageEngineExcludeTypes") {
249 std::stringstream ss(value);
250 for (int i; ss >> i;) {
251 storageEngineExcludeTypes.push_back(i);
252 if (ss.peek() == ',') {
253 ss.ignore();
254 }

Callers

nothing calls this directly

Calls 12

removeWhitespaceFunction · 0.85
deterministicRandomFunction · 0.85
configDBTypeFromStringFunction · 0.85
substrMethod · 0.80
coinflipMethod · 0.80
openMethod · 0.65
closeMethod · 0.65
sizeMethod · 0.45
findMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
peekMethod · 0.45

Tested by

no test coverage detected