Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / common / config_obs.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7  *
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.
12  *
13  */
14
15 #ifndef CEPH_CONFIG_OBS_H
16 #define CEPH_CONFIG_OBS_H
17
18 #include <set>
19 #include <string>
20
21 struct md_config_t;
22
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().
28  */
29 class md_config_obs_t {
30 public:
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;
40   /// Unused for now
41   virtual void handle_subsys_change(const struct md_config_t *conf,
42                                     const std::set<int>& changed) { }
43 };
44
45 #endif