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

Function flatten_node

src/records/RecYAMLDecoder.cc:203–221  ·  view source on GitHub ↗

@brief Iterate over a node and build up the field name from it. This function walks down a YAML node till it find a scalar type while building the record name, so if a node is something like this: diags: debug: enabled: 0 this function will build up the record name "diags.debug.enabled" and then it prepend the "proxy.config" to each name, this will be the record name already known by ATS. Ever

Source from the content-addressed store, hash-verified

201/// @param handler Scalar node function handler, called every time a scalar type is found.
202/// @param errata Holds the errors detected.
203void
204flatten_node(CfgNode const &field, RecYAMLNodeHandler handler, swoc::Errata &errata)
205{
206 switch (field.value_node.Type()) {
207 case YAML::NodeType::Map: {
208 field.append_field_name();
209 for (auto &it : field.value_node) {
210 flatten_node({it.first, it.second, field.get_record_name()}, handler, errata);
211 }
212 } break;
213 case YAML::NodeType::Sequence:
214 case YAML::NodeType::Scalar:
215 case YAML::NodeType::Null: {
216 field.append_field_name();
217 handler(field, errata);
218 } break;
219 default:; // done
220 }
221}
222} // namespace detail
223
224namespace swoc

Callers 1

ParseRecordsFromYAMLFunction · 0.85

Calls 3

append_field_nameMethod · 0.80
get_record_nameMethod · 0.80
TypeMethod · 0.45

Tested by

no test coverage detected