| 13 | |
| 14 | namespace rocksdb { |
| 15 | Status LoadOptionsFromFile(const std::string& file_name, Env* env, |
| 16 | DBOptions* db_options, |
| 17 | std::vector<ColumnFamilyDescriptor>* cf_descs, |
| 18 | bool ignore_unknown_options) { |
| 19 | RocksDBOptionsParser parser; |
| 20 | Status s = parser.Parse(file_name, env, ignore_unknown_options); |
| 21 | if (!s.ok()) { |
| 22 | return s; |
| 23 | } |
| 24 | |
| 25 | *db_options = *parser.db_opt(); |
| 26 | |
| 27 | const std::vector<std::string>& cf_names = *parser.cf_names(); |
| 28 | const std::vector<ColumnFamilyOptions>& cf_opts = *parser.cf_opts(); |
| 29 | cf_descs->clear(); |
| 30 | for (size_t i = 0; i < cf_opts.size(); ++i) { |
| 31 | cf_descs->push_back({cf_names[i], cf_opts[i]}); |
| 32 | } |
| 33 | return Status::OK(); |
| 34 | } |
| 35 | |
| 36 | Status GetLatestOptionsFileName(const std::string& dbpath, |
| 37 | Env* env, std::string* options_file_name) { |