<< " class " << device_class << dendl;
}
- std::map<std::string,pair<std::string,const MaskedOption*>> src;
config = config_map.generate_entity_map(
entity,
crush_location,
osdmap.crush.get(),
- device_class,
- &src);
+ device_class);
});
// get a single value
const map<std::string,std::string>& crush_location,
const CrushWrapper *crush,
const std::string& device_class,
- std::map<std::string,pair<std::string,const MaskedOption*>> *src)
+ std::unordered_map<std::string, ValueSource> *src)
{
// global, then by type, then by name prefix component(s), then name.
// name prefix components are .-separated,
}
out[i.first] = o.raw_value;
if (src) {
- (*src)[i.first] = make_pair(s.first, &o);
+ (*src).emplace(i.first, ConfigMap::ValueSource(s.first, &o));
}
prev = &o;
}
};
struct ConfigMap {
+ struct ValueSource {
+ std::string section;
+ const MaskedOption *option = nullptr;
+ ValueSource() {}
+ ValueSource(const std::string& s, const MaskedOption *o)
+ : section(s), option(o) {}
+ };
+
Section global;
std::map<std::string,Section, std::less<>> by_type;
std::map<std::string,Section, std::less<>> by_id;
stray_options.clear();
}
void dump(ceph::Formatter *f) const;
+
std::map<std::string,std::string,std::less<>> generate_entity_map(
const EntityName& name,
const std::map<std::string,std::string>& crush_location,
const CrushWrapper *crush,
const std::string& device_class,
- std::map<std::string,std::pair<std::string,const MaskedOption*>> *src=0);
+ std::unordered_map<std::string,ValueSource> *src = nullptr);
void parse_key(
const std::string& key,
<< " class " << device_class << dendl;
}
- std::map<std::string,pair<std::string,const MaskedOption*>> src;
+ std::unordered_map<std::string,ConfigMap::ValueSource> src;
auto config = config_map.generate_entity_map(
entity,
crush_location,
continue;
}
if (!f) {
- tbl << q->second.first;
- tbl << q->second.second->mask.to_str();
- tbl << Option::level_to_str(q->second.second->opt->level);
+ tbl << q->second.section;
+ tbl << q->second.option->mask.to_str();
+ tbl << Option::level_to_str(q->second.option->opt->level);
tbl << p->first;
tbl << p->second;
- tbl << (q->second.second->opt->can_update_at_runtime() ? "" : "*");
+ tbl << (q->second.option->opt->can_update_at_runtime() ? "" : "*");
tbl << TextTable::endrow;
} else {
f->open_object_section(p->first.c_str());
f->dump_string("value", p->second);
- f->dump_string("section", q->second.first);
- f->dump_object("mask", q->second.second->mask);
+ f->dump_string("section", q->second.section);
+ f->dump_object("mask", q->second.option->mask);
f->dump_bool("can_update_at_runtime",
- q->second.second->opt->can_update_at_runtime());
+ q->second.option->opt->can_update_at_runtime());
f->close_section();
}
}