1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_MIRROR_ENABLE_REQUEST_H
5 #define CEPH_LIBRBD_MIRROR_ENABLE_REQUEST_H
7 #include "include/buffer.h"
8 #include "cls/rbd/cls_rbd_types.h"
15 namespace librados { class IoCtx; }
23 template <typename ImageCtxT = ImageCtx>
26 static EnableRequest *create(ImageCtxT *image_ctx, Context *on_finish) {
27 return create(image_ctx->md_ctx, image_ctx->id, "",
28 image_ctx->op_work_queue, on_finish);
30 static EnableRequest *create(librados::IoCtx &io_ctx,
31 const std::string &image_id,
32 const std::string &non_primary_global_image_id,
33 ContextWQ *op_work_queue, Context *on_finish) {
34 return new EnableRequest(io_ctx, image_id, non_primary_global_image_id,
35 op_work_queue, on_finish);
47 * GET_MIRROR_MODE * * * * * * *
50 * GET_TAG_OWNER * * * * * * * *
53 * GET_MIRROR_IMAGE * * * * * * *
56 * SET_MIRROR_IMAGE * * * * * * *
59 * NOTIFY_MIRRORING_WATCHER * * *
62 * <finish> < * * * * * * * * *
67 EnableRequest(librados::IoCtx &io_ctx, const std::string &image_id,
68 const std::string &non_primary_global_image_id,
69 ContextWQ *op_work_queue, Context *on_finish);
71 librados::IoCtx &m_io_ctx;
72 std::string m_image_id;
73 std::string m_non_primary_global_image_id;
74 ContextWQ *m_op_work_queue;
77 CephContext *m_cct = nullptr;
78 bool m_is_primary = false;
80 cls::rbd::MirrorImage m_mirror_image;
82 void send_get_tag_owner();
83 Context *handle_get_tag_owner(int *result);
85 void send_get_mirror_image();
86 Context *handle_get_mirror_image(int *result);
88 void send_set_mirror_image();
89 Context *handle_set_mirror_image(int *result);
91 void send_notify_mirroring_watcher();
92 Context *handle_notify_mirroring_watcher(int *result);
98 extern template class librbd::mirror::EnableRequest<librbd::ImageCtx>;
100 #endif // CEPH_LIBRBD_MIRROR_ENABLE_REQUEST_H