]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/ConfigWatcher.h
import ceph quincy 17.2.1
[ceph.git] / ceph / src / librbd / ConfigWatcher.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_LIBRBD_CONFIG_WATCHER_H
5 #define CEPH_LIBRBD_CONFIG_WATCHER_H
6
7 #include <set>
8 #include <string>
9
10 struct Context;
11
12 namespace librbd {
13
14 struct ImageCtx;
15
16 template <typename ImageCtxT>
17 class ConfigWatcher {
18 public:
19 static ConfigWatcher* create(ImageCtxT& image_ctx) {
20 return new ConfigWatcher(image_ctx);
21 }
22
23 ConfigWatcher(ImageCtxT& image_ctx);
24 ~ConfigWatcher();
25
26 ConfigWatcher(const ConfigWatcher&) = delete;
27 ConfigWatcher& operator=(const ConfigWatcher&) = delete;
28
29 void init();
30 void shut_down();
31
32 private:
33 struct Observer;
34
35 ImageCtxT& m_image_ctx;
36
37 Observer* m_observer = nullptr;
38
39 void handle_global_config_change(std::set<std::string> changed);
40
41 };
42
43 } // namespace librbd
44
45 extern template class librbd::ConfigWatcher<librbd::ImageCtx>;
46
47 #endif // CEPH_LIBRBD_CONFIG_WATCHER_H