Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / tools / rbd_mirror / MirrorStatusWatcher.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_RBD_MIRROR_MIRROR_STATUS_WATCHER_H
5 #define CEPH_RBD_MIRROR_MIRROR_STATUS_WATCHER_H
6
7 #include "librbd/Watcher.h"
8
9 namespace librbd { class ImageCtx; }
10
11 namespace rbd {
12 namespace mirror {
13
14 template <typename ImageCtxT = librbd::ImageCtx>
15 class MirrorStatusWatcher : protected librbd::Watcher {
16 public:
17   static MirrorStatusWatcher *create(librados::IoCtx &io_ctx,
18                                      ContextWQ *work_queue) {
19     return new MirrorStatusWatcher(io_ctx, work_queue);
20   }
21   void destroy() {
22     delete this;
23   }
24
25   MirrorStatusWatcher(librados::IoCtx &io_ctx, ContextWQ *work_queue);
26   ~MirrorStatusWatcher() override;
27
28   void init(Context *on_finish);
29   void shut_down(Context *on_finish);
30
31 protected:
32   void handle_notify(uint64_t notify_id, uint64_t handle,
33                      uint64_t notifier_id, bufferlist &bl) override;
34 };
35
36 } // namespace mirror
37 } // namespace rbd
38
39 #endif // CEPH_RBD_MIRROR_MIRROR_STATUS_WATCHER_H