namespace image_replayer {
-using ::testing::_;
-using ::testing::AtLeast;
-using ::testing::DoAll;
-using ::testing::InSequence;
-using ::testing::Invoke;
-using ::testing::MatcherCast;
-using ::testing::Return;
-using ::testing::ReturnArg;
-using ::testing::SetArgPointee;
-using ::testing::WithArg;
-
template<>
struct PrepareLocalImageRequest<librbd::MockTestImageCtx> {
static PrepareLocalImageRequest* s_instance;
namespace rbd {
namespace mirror {
+using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::DoAll;
+using ::testing::InSequence;
+using ::testing::Invoke;
+using ::testing::MatcherCast;
+using ::testing::Return;
+using ::testing::ReturnArg;
+using ::testing::SetArgPointee;
+using ::testing::WithArg;
+
class TestMockImageReplayer : public TestMockFixture {
public:
typedef Threads<librbd::MockTestImageCtx> MockThreads;
typedef ImageDeleter<librbd::MockTestImageCtx> MockImageDeleter;
typedef MirrorStatusUpdater<librbd::MockTestImageCtx> MockMirrorStatusUpdater;
- typedef BootstrapRequest<librbd::MockTestImageCtx> MockBootstrapRequest;
- typedef CloseImageRequest<librbd::MockTestImageCtx> MockCloseImageRequest;
- typedef EventPreprocessor<librbd::MockTestImageCtx> MockEventPreprocessor;
- typedef PrepareLocalImageRequest<librbd::MockTestImageCtx> MockPrepareLocalImageRequest;
- typedef PrepareRemoteImageRequest<librbd::MockTestImageCtx> MockPrepareRemoteImageRequest;
- typedef ReplayStatusFormatter<librbd::MockTestImageCtx> MockReplayStatusFormatter;
+ typedef image_replayer::BootstrapRequest<librbd::MockTestImageCtx> MockBootstrapRequest;
+ typedef image_replayer::CloseImageRequest<librbd::MockTestImageCtx> MockCloseImageRequest;
+ typedef image_replayer::EventPreprocessor<librbd::MockTestImageCtx> MockEventPreprocessor;
+ typedef image_replayer::PrepareLocalImageRequest<librbd::MockTestImageCtx> MockPrepareLocalImageRequest;
+ typedef image_replayer::PrepareRemoteImageRequest<librbd::MockTestImageCtx> MockPrepareRemoteImageRequest;
+ typedef image_replayer::ReplayStatusFormatter<librbd::MockTestImageCtx> MockReplayStatusFormatter;
typedef librbd::journal::Replay<librbd::MockTestImageCtx> MockReplay;
typedef ImageReplayer<librbd::MockTestImageCtx> MockImageReplayer;
typedef InstanceWatcher<librbd::MockTestImageCtx> MockInstanceWatcher;
using librbd::util::create_async_context_callback;
using librbd::util::create_context_callback;
using librbd::util::create_rados_callback;
-using namespace rbd::mirror::image_replayer;
template <typename I>
std::ostream &operator<<(std::ostream &os,
m_local_image_id = "";
Context *ctx = create_context_callback<
ImageReplayer, &ImageReplayer<I>::handle_prepare_local_image>(this);
- auto req = PrepareLocalImageRequest<I>::create(
+ auto req = image_replayer::PrepareLocalImageRequest<I>::create(
m_local_io_ctx, m_global_image_id, &m_local_image_id, &m_local_image_name,
&m_local_image_tag_owner, m_threads->work_queue, ctx);
req->send();
Context *ctx = create_context_callback<
ImageReplayer, &ImageReplayer<I>::handle_prepare_remote_image>(this);
- auto req = PrepareRemoteImageRequest<I>::create(
+ auto req = image_replayer::PrepareRemoteImageRequest<I>::create(
m_threads, m_remote_image.io_ctx, m_global_image_id, m_local_mirror_uuid,
m_local_image_id, journal_settings, m_cache_manager_handler,
&m_remote_image.mirror_uuid, &m_remote_image.image_id, &m_remote_journaler,
return;
}
- BootstrapRequest<I> *request = nullptr;
+ image_replayer::BootstrapRequest<I> *request = nullptr;
{
std::lock_guard locker{m_lock};
if (on_start_interrupted(m_lock)) {
auto ctx = create_context_callback<
ImageReplayer, &ImageReplayer<I>::handle_bootstrap>(this);
- request = BootstrapRequest<I>::create(
+ request = image_replayer::BootstrapRequest<I>::create(
m_threads, m_local_io_ctx, m_remote_image.io_ctx, m_instance_watcher,
&m_local_image_ctx, m_local_image_id, m_remote_image.image_id,
m_global_image_id, m_local_mirror_uuid, m_remote_image.mirror_uuid,
return;
}
- m_replay_status_formatter =
- ReplayStatusFormatter<I>::create(m_remote_journaler, m_local_mirror_uuid);
+ m_replay_status_formatter = image_replayer::ReplayStatusFormatter<I>::create(
+ m_remote_journaler, m_local_mirror_uuid);
Context *on_finish(nullptr);
{
std::swap(m_on_start_finish, on_finish);
}
- m_event_preprocessor = EventPreprocessor<I>::create(
+ m_event_preprocessor = image_replayer::EventPreprocessor<I>::create(
*m_local_image_ctx, *m_remote_journaler, m_local_mirror_uuid,
&m_client_meta, m_threads->work_queue);
// close the local image (release exclusive lock)
if (m_local_image_ctx) {
ctx = new LambdaContext([this, ctx](int r) {
- CloseImageRequest<I> *request = CloseImageRequest<I>::create(
+ auto request = image_replayer::CloseImageRequest<I>::create(
&m_local_image_ctx, ctx);
request->send();
});
m_local_journal->stop_external_replay();
m_local_replay = nullptr;
- EventPreprocessor<I>::destroy(m_event_preprocessor);
+ image_replayer::EventPreprocessor<I>::destroy(m_event_preprocessor);
m_event_preprocessor = nullptr;
ctx->complete(0);
});
}
dout(10) << "stop complete" << dendl;
- ReplayStatusFormatter<I>::destroy(m_replay_status_formatter);
+ image_replayer::ReplayStatusFormatter<I>::destroy(m_replay_status_formatter);
m_replay_status_formatter = nullptr;
Context *on_start = nullptr;