| 368 | } |
| 369 | |
| 370 | int RocksDBStore::ParseOptionsFromStringStatic( |
| 371 | CephContext *cct, |
| 372 | const string& opt_str, |
| 373 | rocksdb::Options& opt, |
| 374 | function<int(const string&, const string&, rocksdb::Options&)> interp) |
| 375 | { |
| 376 | // keep aligned with func tryInterpret |
| 377 | const set<string> need_interp_keys = {"compaction_threads", "flusher_threads", "compact_on_mount", "disableWAL"}; |
| 378 | rocksdb::Status status; |
| 379 | std::unordered_map<std::string, std::string> str_map; |
| 380 | status = StringToMap(opt_str, &str_map); |
| 381 | if (!status.ok()) { |
| 382 | dout(5) << __func__ << " error '" << status.getState() << |
| 383 | "' while parsing options '" << opt_str << "'" << dendl; |
| 384 | return -EINVAL; |
| 385 | } |
| 386 | |
| 387 | for (auto it = str_map.begin(); it != str_map.end(); ++it) { |
| 388 | string this_opt = it->first + "=" + it->second; |
| 389 | rocksdb::Status status = |
| 390 | rocksdb::GetOptionsFromString(opt, this_opt, &opt); |
| 391 | int r = 0; |
| 392 | if (!status.ok()) { |
| 393 | if (interp != nullptr) { |
| 394 | r = interp(it->first, it->second, opt); |
| 395 | } else if (!need_interp_keys.count(it->first)) { |
| 396 | r = -1; |
| 397 | } |
| 398 | if (r < 0) { |
| 399 | derr << status.ToString() << dendl; |
| 400 | return -EINVAL; |
| 401 | } |
| 402 | } |
| 403 | lgeneric_dout(cct, 1) << " set rocksdb option " << it->first |
| 404 | << " = " << it->second << dendl; |
| 405 | } |
| 406 | return 0; |
| 407 | } |
| 408 | |
| 409 | int RocksDBStore::init(string _options_str) |
| 410 | { |
nothing calls this directly
no test coverage detected