MCPcopy Create free account
hub / github.com/apache/trafficserver / ParseRecordsFromYAML

Function ParseRecordsFromYAML

src/records/RecYAMLDecoder.cc:142–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140};
141
142swoc::Errata
143ParseRecordsFromYAML(YAML::Node root, RecYAMLNodeHandler handler, bool lock /*false by default*/)
144{
145 [[maybe_unused]] detail::scoped_cond_lock cond_lock(lock);
146
147 swoc::Errata errata;
148 if (YAML::NodeType::Map != root.Type()) {
149 return swoc::Errata(ERRATA_ERROR, "Node is expected to be a map, got '{}' instead.", root.Type());
150 }
151
152 if (auto ts = root[RECORD_YAML_ROOT_STR]; ts.size()) {
153 for (auto &&n : ts) {
154 detail::flatten_node({n.first, n.second, CONFIG_RECORD_PREFIX}, handler, errata);
155 }
156 } else {
157 return swoc::Errata(ERRATA_ERROR, "'{}' root key not present or no fields to read. Default values will be used",
158 RECORD_YAML_ROOT_STR);
159 }
160
161 return errata;
162}
163
164namespace detail
165{

Callers 2

RecYAMLConfigFileParseFunction · 0.85
TSRecYAMLConfigParseFunction · 0.85

Calls 4

ErrataClass · 0.85
flatten_nodeFunction · 0.85
TypeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected