1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef RBD_MIRROR_IMAGE_SYNC_SYNC_POINT_CREATE_REQUEST_H
5 #define RBD_MIRROR_IMAGE_SYNC_SYNC_POINT_CREATE_REQUEST_H
7 #include "librbd/journal/Types.h"
8 #include "librbd/journal/TypeTraits.h"
12 namespace journal { class Journaler; }
13 namespace librbd { class ImageCtx; }
14 namespace librbd { namespace journal { struct MirrorPeerClientMeta; } }
18 namespace image_sync {
20 template <typename ImageCtxT = librbd::ImageCtx>
21 class SyncPointCreateRequest {
23 typedef librbd::journal::TypeTraits<ImageCtxT> TypeTraits;
24 typedef typename TypeTraits::Journaler Journaler;
25 typedef librbd::journal::MirrorPeerClientMeta MirrorPeerClientMeta;
26 typedef librbd::journal::MirrorPeerSyncPoint MirrorPeerSyncPoint;
28 static SyncPointCreateRequest* create(ImageCtxT *remote_image_ctx,
29 const std::string &mirror_uuid,
31 MirrorPeerClientMeta *client_meta,
33 return new SyncPointCreateRequest(remote_image_ctx, mirror_uuid, journaler,
34 client_meta, on_finish);
37 SyncPointCreateRequest(ImageCtxT *remote_image_ctx,
38 const std::string &mirror_uuid, Journaler *journaler,
39 MirrorPeerClientMeta *client_meta, Context *on_finish);
54 * | . (repeat on EEXIST)
67 ImageCtxT *m_remote_image_ctx;
68 std::string m_mirror_uuid;
69 Journaler *m_journaler;
70 MirrorPeerClientMeta *m_client_meta;
73 MirrorPeerClientMeta m_client_meta_copy;
75 void send_update_client();
76 void handle_update_client(int r);
78 void send_refresh_image();
79 void handle_refresh_image(int r);
81 void send_create_snap();
82 void handle_create_snap(int r);
84 void send_final_refresh_image();
85 void handle_final_refresh_image(int r);
90 } // namespace image_sync
94 extern template class rbd::mirror::image_sync::SyncPointCreateRequest<librbd::ImageCtx>;
96 #endif // RBD_MIRROR_IMAGE_SYNC_SYNC_POINT_CREATE_REQUEST_H