]> git.proxmox.com Git - ceph.git/blob - ceph/src/tools/rbd_mirror/image_replayer/snapshot/StateBuilder.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / tools / rbd_mirror / image_replayer / snapshot / StateBuilder.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 CEPH_RBD_MIRROR_IMAGE_REPLAYER_SNAPSHOT_STATE_BUILDER_H
5 #define CEPH_RBD_MIRROR_IMAGE_REPLAYER_SNAPSHOT_STATE_BUILDER_H
6
7 #include "tools/rbd_mirror/image_replayer/StateBuilder.h"
8 #include <string>
9
10 struct Context;
11
12 namespace librbd {
13
14 struct ImageCtx;
15
16 namespace mirror {
17 namespace snapshot {
18
19 template <typename> class ImageMeta;
20
21 } // namespace snapshot
22 } // namespace mirror
23 } // namespace librbd
24
25 namespace rbd {
26 namespace mirror {
27 namespace image_replayer {
28 namespace snapshot {
29
30 template <typename> class SyncPointHandler;
31
32 template <typename ImageCtxT>
33 class StateBuilder : public image_replayer::StateBuilder<ImageCtxT> {
34 public:
35 static StateBuilder* create(const std::string& global_image_id) {
36 return new StateBuilder(global_image_id);
37 }
38
39 StateBuilder(const std::string& global_image_id);
40 ~StateBuilder() override;
41
42 void close(Context* on_finish) override;
43
44 bool is_disconnected() const override;
45
46 cls::rbd::MirrorImageMode get_mirror_image_mode() const override;
47
48 image_sync::SyncPointHandler* create_sync_point_handler() override;
49
50 bool replay_requires_remote_image() const override {
51 return true;
52 }
53
54 BaseRequest* create_local_image_request(
55 Threads<ImageCtxT>* threads,
56 librados::IoCtx& local_io_ctx,
57 const std::string& global_image_id,
58 PoolMetaCache* pool_meta_cache,
59 ProgressContext* progress_ctx,
60 Context* on_finish) override;
61
62 BaseRequest* create_prepare_replay_request(
63 const std::string& local_mirror_uuid,
64 ProgressContext* progress_ctx,
65 bool* resync_requested,
66 bool* syncing,
67 Context* on_finish) override;
68
69 image_replayer::Replayer* create_replayer(
70 Threads<ImageCtxT>* threads,
71 InstanceWatcher<ImageCtxT>* instance_watcher,
72 const std::string& local_mirror_uuid,
73 PoolMetaCache* pool_meta_cache,
74 ReplayerListener* replayer_listener) override;
75
76 SyncPointHandler<ImageCtxT>* sync_point_handler = nullptr;
77
78 std::string remote_mirror_peer_uuid;
79
80 librbd::mirror::snapshot::ImageMeta<ImageCtxT>* local_image_meta = nullptr;
81
82 private:
83 bool is_linked_impl() const override;
84 };
85
86 } // namespace snapshot
87 } // namespace image_replayer
88 } // namespace mirror
89 } // namespace rbd
90
91 extern template class rbd::mirror::image_replayer::snapshot::StateBuilder<librbd::ImageCtx>;
92
93 #endif // CEPH_RBD_MIRROR_IMAGE_REPLAYER_SNAPSHOT_STATE_BUILDER_H