| 203 | } |
| 204 | |
| 205 | auto |
| 206 | FeatureGroup::load_key(Config &cfg, FeatureGroup::Tracking &tracking, swoc::TextView name) -> Rv<Tracking::Info *> |
| 207 | { |
| 208 | YAML::Node n{tracking._node[name]}; |
| 209 | |
| 210 | // Check if the key is present in the node. If not, it must be a referenced key because |
| 211 | // the presence of explicit keys is checked before loading any keys. |
| 212 | if (!n) { |
| 213 | return Errata(S_ERROR, R"("{}" is referenced but no such key was found.)", name); |
| 214 | } |
| 215 | |
| 216 | auto tinfo = tracking.obtain(name); |
| 217 | |
| 218 | if (tinfo->_mark == DONE) { // already loaded, presumably due to a reference. |
| 219 | return tinfo; |
| 220 | } |
| 221 | |
| 222 | if (tinfo->_mark == IN_PLAY) { |
| 223 | return Errata(S_ERROR, R"(Circular dependency for key "{}" at {}.)", name, tracking._node.Mark()); |
| 224 | } |
| 225 | tinfo->_mark = IN_PLAY; |
| 226 | |
| 227 | Errata errata{this->load_expr(cfg, tracking, tinfo, n)}; |
| 228 | if (!errata.is_ok()) { |
| 229 | errata.note(R"(While loading extraction format for key "{}" at {}.)", name, tracking._node.Mark()); |
| 230 | return errata; |
| 231 | } |
| 232 | |
| 233 | tinfo->_mark = DONE; |
| 234 | return tinfo; |
| 235 | } |
| 236 | |
| 237 | Errata |
| 238 | FeatureGroup::load(Config &cfg, YAML::Node const &node, std::initializer_list<FeatureGroup::Descriptor> const &ex_keys) |