MCPcopy Create free account
hub / github.com/ceph/ceph / ConfFile

Method ConfFile

src/common/ConfUtils.cc:83–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81///////////////////////// ConfFile //////////////////////////
82
83ConfFile::ConfFile(const std::vector<conf_section_t>& sections)
84{
85 for (auto& section : sections) {
86 auto [old_sec, sec_inserted] = emplace(section.heading, section);
87 if (!sec_inserted) {
88 // merge lines in section into old_sec
89 for (auto& line : section) {
90 auto [old_line, line_inserted] = old_sec->second.emplace(line);
91 // and replace the existing ones if any
92 if (!line_inserted) {
93 old_sec->second.erase(old_line);
94 old_sec->second.insert(line);
95 }
96 }
97 }
98 }
99}
100
101/* We load the whole file into memory and then parse it. Although this is not
102 * the optimal approach, it does mean that most of this code can be shared with

Callers

nothing calls this directly

Calls 4

emplaceFunction · 0.50
emplaceMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected