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_PRUNE_REQUEST_H
5 #define RBD_MIRROR_IMAGE_SYNC_SYNC_POINT_PRUNE_REQUEST_H
7 #include "librbd/journal/Types.h"
8 #include "librbd/journal/TypeTraits.h"
13 namespace journal { class Journaler; }
14 namespace librbd { class ImageCtx; }
15 namespace librbd { namespace journal { struct MirrorPeerClientMeta; } }
19 namespace image_sync {
21 template <typename ImageCtxT = librbd::ImageCtx>
22 class SyncPointPruneRequest {
24 typedef librbd::journal::TypeTraits<ImageCtxT> TypeTraits;
25 typedef typename TypeTraits::Journaler Journaler;
26 typedef librbd::journal::MirrorPeerClientMeta MirrorPeerClientMeta;
27 typedef librbd::journal::MirrorPeerSyncPoint MirrorPeerSyncPoint;
29 static SyncPointPruneRequest* create(ImageCtxT *remote_image_ctx,
32 MirrorPeerClientMeta *client_meta,
34 return new SyncPointPruneRequest(remote_image_ctx, sync_complete, journaler,
35 client_meta, on_finish);
38 SyncPointPruneRequest(ImageCtxT *remote_image_ctx, bool sync_complete,
39 Journaler *journaler, MirrorPeerClientMeta *client_meta,
52 * v v . (repeat if from snap
53 * REMOVE_SNAP . . . unused by other sync)
67 ImageCtxT *m_remote_image_ctx;
69 Journaler *m_journaler;
70 MirrorPeerClientMeta *m_client_meta;
73 MirrorPeerClientMeta m_client_meta_copy;
74 std::list<std::string> m_snap_names;
76 bool m_invalid_master_sync_point = false;
78 void send_remove_snap();
79 void handle_remove_snap(int r);
81 void send_refresh_image();
82 void handle_refresh_image(int r);
84 void send_update_client();
85 void handle_update_client(int r);
90 } // namespace image_sync
94 extern template class rbd::mirror::image_sync::SyncPointPruneRequest<librbd::ImageCtx>;
96 #endif // RBD_MIRROR_IMAGE_SYNC_SYNC_POINT_PRUNE_REQUEST_H