Make specific configuration overrides override global configuration overrides

This commit is contained in:
sfc-gh-tclinkenbeard 2021-05-21 16:21:31 -07:00
parent ec7a92342a
commit a12f68d78c
2 changed files with 10 additions and 6 deletions

View File

@ -372,8 +372,9 @@ ACTOR template <class Env>
Future<Void> testGlobalSet() {
state Env env("class-A");
wait(env.setup());
wait(set(env, "class-A"_sr, 1));
wait(set(env, Optional<KeyRef>{}, 10));
wait(set(env, Optional<KeyRef>{}, 1));
env.check(1);
wait(set(env, "class-A"_sr, 10));
env.check(10);
return Void();
}

View File

@ -81,16 +81,19 @@ public:
template <class... KS>
void update(KS&... knobCollections) const {
// Apply global overrides
const auto& knobToValue = configClassToKnobToValue.at({});
for (const auto& [knobName, knobValue] : knobToValue) {
updateSingleKnob(knobName, knobValue, knobCollections...);
}
// Apply specific overrides
for (const auto& configClass : configPath) {
const auto& knobToValue = configClassToKnobToValue.at(configClass);
for (const auto& [knobName, knobValue] : knobToValue) {
updateSingleKnob(knobName, knobValue, knobCollections...);
}
}
const auto& knobToValue = configClassToKnobToValue.at({});
for (const auto& [knobName, knobValue] : knobToValue) {
updateSingleKnob(knobName, knobValue, knobCollections...);
}
}
bool hasSameConfigPath(ConfigKnobOverrides const& other) const { return configPath == other.configPath; }