]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: moved pool watcher listener interface out of templated class
authorJason Dillaman <dillaman@redhat.com>
Thu, 8 Mar 2018 21:49:07 +0000 (16:49 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 10 Apr 2018 20:31:32 +0000 (16:31 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/test_PoolWatcher.cc
src/test/rbd_mirror/test_mock_PoolWatcher.cc
src/tools/rbd_mirror/PoolReplayer.h
src/tools/rbd_mirror/PoolWatcher.cc
src/tools/rbd_mirror/PoolWatcher.h
src/tools/rbd_mirror/pool_watcher/Types.h [new file with mode: 0644]

index 06dcd570b32f36dc7babef4cdecb9fef60131137..74383d96b43cac73447bf755bb393155a8365467 100644 (file)
@@ -20,6 +20,7 @@
 #include "tools/rbd_mirror/PoolWatcher.h"
 #include "tools/rbd_mirror/Threads.h"
 #include "tools/rbd_mirror/types.h"
+#include "tools/rbd_mirror/pool_watcher/Types.h"
 #include "test/librados/test.h"
 #include "gtest/gtest.h"
 #include <boost/scope_exit.hpp>
@@ -67,7 +68,7 @@ public:
     TestFixture::TearDown();
   }
 
-  struct PoolWatcherListener : public PoolWatcher<>::Listener {
+  struct PoolWatcherListener : public rbd::mirror::pool_watcher::Listener {
     TestPoolWatcher *test;
     Cond cond;
     ImageIds image_ids;
index 3300c63ceb6a62100f400a4ca94ee19ac3f72f75..07f9a4d62f8a4ea7b81d7a87e7bbd177e4550740 100644 (file)
@@ -158,7 +158,7 @@ public:
   typedef librbd::MockMirroringWatcher MockMirroringWatcher;
   typedef librbd::MirroringWatcher<librbd::MockTestImageCtx> MirroringWatcher;
 
-  struct MockListener : MockPoolWatcher::Listener {
+  struct MockListener : pool_watcher::Listener {
     TestMockPoolWatcher *test;
 
     MockListener(TestMockPoolWatcher *test) : test(test) {
index f17bd9eb878cb233c71ab1f32b1e90040b31d2a1..3bcb1ed5fe88aacb9221eb5e97b7703ab9f6edb2 100644 (file)
@@ -15,6 +15,7 @@
 #include "PoolWatcher.h"
 #include "ImageDeleter.h"
 #include "types.h"
+#include "tools/rbd_mirror/pool_watcher/Types.h"
 #include "tools/rbd_mirror/service_daemon/Types.h"
 
 #include <set>
@@ -98,7 +99,7 @@ private:
    * @endverbatim
    */
 
-  struct PoolWatcherListener : public PoolWatcher<>::Listener {
+  struct PoolWatcherListener : public pool_watcher::Listener {
     PoolReplayer *pool_replayer;
     bool local;
 
index 8d60aa4f47a8c6a440a3b89545381c57a8bbaae3..9056a615ddd600f6ade263488a03537ddec396a8 100644 (file)
@@ -69,7 +69,7 @@ private:
 
 template <typename I>
 PoolWatcher<I>::PoolWatcher(Threads<I> *threads, librados::IoCtx &remote_io_ctx,
-                            Listener &listener)
+                            pool_watcher::Listener &listener)
   : m_threads(threads), m_remote_io_ctx(remote_io_ctx), m_listener(listener),
     m_lock(librbd::util::unique_lock_name("rbd::mirror::PoolWatcher", this)) {
   m_mirroring_watcher = new MirroringWatcher(m_remote_io_ctx,
index 9a02bad4bd83ae4398767ff1d2761d8ed5f1f049..9949ecddec819f75e928266f700fc32a0b199ef9 100644 (file)
@@ -17,6 +17,7 @@
 #include <boost/functional/hash.hpp>
 #include <boost/optional.hpp>
 #include "include/assert.h"
+#include "tools/rbd_mirror/pool_watcher/Types.h"
 
 namespace librbd { struct ImageCtx; }
 
@@ -32,17 +33,8 @@ template <typename> struct Threads;
 template <typename ImageCtxT = librbd::ImageCtx>
 class PoolWatcher {
 public:
-  struct Listener {
-    virtual ~Listener() {
-    }
-
-    virtual void handle_update(const std::string &mirror_uuid,
-                               ImageIds &&added_image_ids,
-                               ImageIds &&removed_image_ids) = 0;
-  };
-
   PoolWatcher(Threads<ImageCtxT> *threads, librados::IoCtx &remote_io_ctx,
-              Listener &listener);
+              pool_watcher::Listener &listener);
   ~PoolWatcher();
   PoolWatcher(const PoolWatcher&) = delete;
   PoolWatcher& operator=(const PoolWatcher&) = delete;
@@ -106,7 +98,7 @@ private:
 
   Threads<ImageCtxT> *m_threads;
   librados::IoCtx m_remote_io_ctx;
-  Listener &m_listener;
+  pool_watcher::Listener &m_listener;
 
   ImageIds m_refresh_image_ids;
   bufferlist m_out_bl;
diff --git a/src/tools/rbd_mirror/pool_watcher/Types.h b/src/tools/rbd_mirror/pool_watcher/Types.h
new file mode 100644 (file)
index 0000000..45fdd51
--- /dev/null
@@ -0,0 +1,27 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_RBD_MIRROR_POOL_WATCHER_TYPES_H
+#define CEPH_RBD_MIRROR_POOL_WATCHER_TYPES_H
+
+#include "tools/rbd_mirror/types.h"
+#include <string>
+
+namespace rbd {
+namespace mirror {
+namespace pool_watcher {
+
+struct Listener {
+  virtual ~Listener() {
+  }
+
+  virtual void handle_update(const std::string &mirror_uuid,
+                             ImageIds &&added_image_ids,
+                             ImageIds &&removed_image_ids) = 0;
+};
+
+} // namespace pool_watcher
+} // namespace mirror
+} // namespace rbd
+
+#endif // CEPH_RBD_MIRROR_POOL_WATCHER_TYPES_H