#include "common/AsyncOpTracker.h"
#include "common/ceph_context.h"
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
#include "include/rados/librados.hpp"
#include "tools/rbd_mirror/Types.h"
#include <boost/functional/hash.hpp>
class PoolWatcher {
public:
static PoolWatcher* create(Threads<ImageCtxT> *threads,
- librados::IoCtx &remote_io_ctx,
+ librados::IoCtx &io_ctx,
+ const std::string& mirror_uuid,
pool_watcher::Listener &listener) {
- return new PoolWatcher(threads, remote_io_ctx, listener);
+ return new PoolWatcher(threads, io_ctx, mirror_uuid, listener);
}
- PoolWatcher(Threads<ImageCtxT> *threads, librados::IoCtx &remote_io_ctx,
+ PoolWatcher(Threads<ImageCtxT> *threads,
+ librados::IoCtx &io_ctx,
+ const std::string& mirror_uuid,
pool_watcher::Listener &listener);
~PoolWatcher();
PoolWatcher(const PoolWatcher&) = delete;
void shut_down(Context *on_finish);
inline uint64_t get_image_count() const {
- Mutex::Locker locker(m_lock);
+ std::lock_guard locker{m_lock};
return m_image_ids.size();
}
* |/----------------------------\ |
* | | |
* v | |
- * GET_MIRROR_UUID | |
- * | | |
- * v | |
* NOTIFY_LISTENER | |
* | | |
* v | |
class MirroringWatcher;
Threads<ImageCtxT> *m_threads;
- librados::IoCtx m_remote_io_ctx;
+ librados::IoCtx m_io_ctx;
+ std::string m_mirror_uuid;
pool_watcher::Listener &m_listener;
ImageIds m_refresh_image_ids;
bufferlist m_out_bl;
- mutable Mutex m_lock;
+ mutable ceph::mutex m_lock;
Context *m_on_init_finish = nullptr;
ImageIds m_image_ids;
- std::string m_mirror_uuid;
bool m_pending_updates = false;
bool m_notify_listener_in_progress = false;
ImageIds m_pending_added_image_ids;
ImageIds m_pending_removed_image_ids;
- std::string m_pending_mirror_uuid;
-
MirroringWatcher *m_mirroring_watcher;
Context *m_timer_ctx = nullptr;
void schedule_refresh_images(double interval);
void process_refresh_images();
- void get_mirror_uuid();
- void handle_get_mirror_uuid(int r);
-
void handle_rewatch_complete(int r);
- void handle_image_updated(const std::string &remote_image_id,
+ void handle_image_updated(const std::string &image_id,
const std::string &global_image_id,
bool enabled);