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

Function TSRecYAMLConfigParse

src/api/InkAPI.cc:8990–9018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8988}
8989
8990TSReturnCode
8991TSRecYAMLConfigParse(TSYaml node, TSYAMLRecNodeHandler handler, void *data)
8992{
8993 swoc::Errata err;
8994 try {
8995 err = ParseRecordsFromYAML(
8996 *reinterpret_cast<YAML::Node *>(node),
8997 [handler, data](const CfgNode &field, swoc::Errata &) -> void {
8998 // Errors from the handler should be reported and handled by the handler.
8999 // RecYAMLConfigFileParse will report any YAML parsing error.
9000 TSYAMLRecCfgFieldData cfg;
9001 auto const &field_str = field.node.as<std::string>();
9002 cfg.field_name = field_str.c_str();
9003 cfg.record_name = field.get_record_name().data();
9004 cfg.value_node = reinterpret_cast<TSYaml>(const_cast<YAML::Node *>(&field.value_node));
9005 handler(&cfg, data);
9006 },
9007 true /* lock */);
9008 } catch (std::exception const &ex) {
9009 err.note(ERRATA_ERROR, "RecYAMLConfigParse error cought: {}", ex.what());
9010 }
9011 // Drop API logs in case of an error.
9012 if (!err.empty()) {
9013 std::string buf;
9014 Dbg(dbg_ctl_plugin, "%s", swoc::bwprint(buf, "{}", err).c_str());
9015 }
9016
9017 return err.empty() ? TS_SUCCESS : TS_ERROR;
9018}
9019
9020TSTxnType
9021TSHttpTxnTypeGet(TSHttpTxn txnp)

Callers 1

parse_fileMethod · 0.85

Calls 7

ParseRecordsFromYAMLFunction · 0.85
get_record_nameMethod · 0.80
c_strMethod · 0.45
dataMethod · 0.45
noteMethod · 0.45
whatMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected