File tree Expand file tree Collapse file tree 3 files changed +10
-29
lines changed
Expand file tree Collapse file tree 3 files changed +10
-29
lines changed Original file line number Diff line number Diff line change 2020
2121/* *
2222 * A simple class to cache a single configuration value.
23- * Points to note:
24- * - as get_tracked_conf_keys() must return a pointer to a null-terminated
25- * array of C-strings, 'keys' - an array - is used to hold the sole key
26- * that this observer is interested in.
27- * - the const cast should be removed once we change the
28- * get_tracked_conf_keys() to return const char* const * (or something
29- * similar).
23+ *
24+ * The md_config_cacher_t object registers itself to receive
25+ * notifications of changes to the specified single configuration
26+ * option. When the option changes, the new value is stored
27+ * in an atomic variable. The value can be accessed using
28+ * the dereference operator.
3029 */
3130template <typename ValueT>
3231class md_config_cacher_t : public md_config_obs_t {
Original file line number Diff line number Diff line change @@ -33,27 +33,16 @@ class md_config_obs_impl {
3333public:
3434 virtual ~md_config_obs_impl () {}
3535
36- /* * @brief Get a table of strings specifying the configuration keys in which the object is interested.
37- * This is called when the object is subscribed to configuration changes with add_observer().
38- * The returned table should not be freed until the observer is removed with remove_observer().
39- * Note that it is not possible to change the set of tracked keys without re-subscribing.
40- *
41- * DEPRECATED! Use get_tracked_keys() instead.
42- */
43- virtual const char ** get_tracked_conf_keys () const {
44- return nullptr ;
45- }
46-
4736 /* *
4837 * Returns a vector of strings specifying the configuration keys in which
49- * the object is interested.
38+ * the object is interested. This is called when the object is subscribed to
39+ * configuration changes with add_observer().
40+ *
5041 * Note - the strings in the returned vector are 'moveable'. The caller
5142 * (ostensibly the observer manager) is expected to move them into its
5243 * map.
5344 */
54- virtual std::vector<std::string> get_tracked_keys () const noexcept {
55- return {};
56- }
45+ virtual std::vector<std::string> get_tracked_keys () const noexcept = 0;
5746
5847 // / React to a configuration change.
5948 virtual void handle_conf_change (const ConfigProxy& conf,
Original file line number Diff line number Diff line change @@ -65,13 +65,6 @@ void ObserverMgr<ConfigObs>::add_observer(ConfigObs* observer)
6565 for (auto && k : observer->get_tracked_keys ()) {
6666 observers.emplace (std::move (k), ptr);
6767 }
68-
69- // legacy observer interface:
70- if (const char ** keys = observer->get_tracked_conf_keys (); keys) {
71- for (const char ** k = keys; *k; ++k) {
72- observers.emplace (*k, ptr);
73- }
74- }
7568}
7669
7770template <class ConfigObs >
You can’t perform that action at this time.
0 commit comments