]> git.proxmox.com Git - ceph.git/blob - ceph/src/tools/rbd_mirror/image_replayer/snapshot/PrepareReplayRequest.h
import ceph quincy 17.2.4
[ceph.git] / ceph / src / tools / rbd_mirror / image_replayer / snapshot / PrepareReplayRequest.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef RBD_MIRROR_IMAGE_REPLAYER_JOURNAL_PREPARE_REPLAY_REQUEST_H
5 #define RBD_MIRROR_IMAGE_REPLAYER_JOURNAL_PREPARE_REPLAY_REQUEST_H
6
7 #include "include/int_types.h"
8 #include "librbd/mirror/Types.h"
9 #include "tools/rbd_mirror/BaseRequest.h"
10 #include <list>
11 #include <string>
12
13 struct Context;
14 namespace librbd { struct ImageCtx; }
15
16 namespace rbd {
17 namespace mirror {
18
19 class ProgressContext;
20
21 namespace image_replayer {
22 namespace snapshot {
23
24 template <typename> class StateBuilder;
25
26 template <typename ImageCtxT>
27 class PrepareReplayRequest : public BaseRequest {
28 public:
29 static PrepareReplayRequest* create(
30 const std::string& local_mirror_uuid,
31 ProgressContext* progress_ctx,
32 StateBuilder<ImageCtxT>* state_builder,
33 bool* resync_requested,
34 bool* syncing,
35 Context* on_finish) {
36 return new PrepareReplayRequest(
37 local_mirror_uuid, progress_ctx, state_builder, resync_requested,
38 syncing, on_finish);
39 }
40
41 PrepareReplayRequest(
42 const std::string& local_mirror_uuid,
43 ProgressContext* progress_ctx,
44 StateBuilder<ImageCtxT>* state_builder,
45 bool* resync_requested,
46 bool* syncing,
47 Context* on_finish)
48 : BaseRequest(on_finish),
49 m_local_mirror_uuid(local_mirror_uuid),
50 m_progress_ctx(progress_ctx),
51 m_state_builder(state_builder),
52 m_resync_requested(resync_requested),
53 m_syncing(syncing) {
54 }
55
56 void send() override;
57
58 private:
59 // TODO
60 /**
61 * @verbatim
62 *
63 * <start>
64 * |
65 * v
66 * LOAD_LOCAL_IMAGE_META
67 * |
68 * v
69 * <finish>
70 *
71 * @endverbatim
72 */
73
74 std::string m_local_mirror_uuid;
75 ProgressContext* m_progress_ctx;
76 StateBuilder<ImageCtxT>* m_state_builder;
77 bool* m_resync_requested;
78 bool* m_syncing;
79
80 void load_local_image_meta();
81 void handle_load_local_image_meta(int r);
82
83 };
84
85 } // namespace snapshot
86 } // namespace image_replayer
87 } // namespace mirror
88 } // namespace rbd
89
90 extern template class rbd::mirror::image_replayer::snapshot::PrepareReplayRequest<librbd::ImageCtx>;
91
92 #endif // RBD_MIRROR_IMAGE_REPLAYER_JOURNAL_PREPARE_REPLAY_REQUEST_H