Skip to content

Commit 9d224ab

Browse files
committed
common: modify md_config_cacher_t to implement get_tracked_keys()
Modify the md_config_cacher_t to implement the new get_tracked_keys() callback, instead of the deprecated char* based get_tracked_conf_keys(). Signed-off-by: Ronen Friedman <[email protected]>
1 parent 48a43f0 commit 9d224ab

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/common/config_cacher.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@
3131
template <typename ValueT>
3232
class md_config_cacher_t : public md_config_obs_t {
3333
ConfigProxy& conf;
34-
const char* keys[2];
34+
const std::string option_name;
3535
std::atomic<ValueT> value_cache;
3636

37-
const char** get_tracked_conf_keys() const override {
38-
return const_cast<const char**>(keys);
37+
std::vector<std::string> get_tracked_keys() const noexcept override {
38+
return std::vector<std::string>{option_name};
3939
}
4040

4141
void handle_conf_change(const ConfigProxy& conf,
4242
const std::set<std::string>& changed) override {
43-
if (changed.contains(keys[0])) {
44-
value_cache.store(conf.get_val<ValueT>(keys[0]));
43+
if (changed.contains(option_name)) {
44+
value_cache.store(conf.get_val<ValueT>(option_name));
4545
}
4646
}
4747

4848
public:
4949
md_config_cacher_t(ConfigProxy& conf,
5050
const char* const option_name)
51-
: conf(conf),
52-
keys{option_name, nullptr} {
51+
: conf(conf)
52+
, option_name{option_name} {
5353
conf.add_observer(this);
5454
std::atomic_init(&value_cache,
55-
conf.get_val<ValueT>(keys[0]));
55+
conf.get_val<ValueT>(option_name));
5656
}
5757

5858
~md_config_cacher_t() {

0 commit comments

Comments
 (0)