| 140 | }; |
| 141 | |
| 142 | swoc::Errata |
| 143 | ParseRecordsFromYAML(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 | |
| 164 | namespace detail |
| 165 | { |
no test coverage detected