1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_CONFIG_OBS_H
16 #define CEPH_CONFIG_OBS_H
23 /** @brief Base class for configuration observers.
24 * Use this as a base class for your object if it has to respond to configuration changes,
25 * for example by updating some values or modifying its behavior.
26 * Subscribe for configuration changes by calling the md_config_t::add_observer() method
27 * and unsubscribe using md_config_t::remove_observer().
29 class md_config_obs_t {
31 virtual ~md_config_obs_t() {}
32 /** @brief Get a table of strings specifying the configuration keys in which the object is interested.
33 * This is called when the object is subscribed to configuration changes with add_observer().
34 * The returned table should not be freed until the observer is removed with remove_observer().
35 * Note that it is not possible to change the set of tracked keys without re-subscribing. */
36 virtual const char** get_tracked_conf_keys() const = 0;
37 /// React to a configuration change.
38 virtual void handle_conf_change(const struct md_config_t *conf,
39 const std::set <std::string> &changed) = 0;
41 virtual void handle_subsys_change(const struct md_config_t *conf,
42 const std::set<int>& changed) { }