]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/mirror/ImageRemoveRequest.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / librbd / mirror / ImageRemoveRequest.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_LIBRBD_MIRROR_IMAGE_REMOVE_REQUEST_H
5 #define CEPH_LIBRBD_MIRROR_IMAGE_REMOVE_REQUEST_H
6
7 #include "include/rados/librados.hpp"
8 #include "common/ceph_mutex.h"
9 #include "cls/rbd/cls_rbd_types.h"
10
11 #include <string>
12
13 class Context;
14
15 namespace librbd {
16
17 class ImageCtx;
18
19 namespace mirror {
20
21 template <typename ImageCtxT = ImageCtx>
22 class ImageRemoveRequest {
23 public:
24 static ImageRemoveRequest *create(librados::IoCtx& io_ctx,
25 const std::string& global_image_id,
26 const std::string& image_id,
27 Context* on_finish) {
28 return new ImageRemoveRequest(io_ctx, global_image_id, image_id, on_finish);
29 }
30
31 ImageRemoveRequest(librados::IoCtx& io_ctx,
32 const std::string& global_image_id,
33 const std::string& image_id,
34 Context* on_finish);
35
36 void send();
37
38 private:
39 /**
40 * @verbatim
41 *
42 * <start>
43 * |
44 * REMOVE_MIRROR_IMAGE
45 * |
46 * v
47 * NOTIFY_MIRRORING_WATCHER
48 * |
49 * v
50 * <finish>
51 *
52 * @endverbatim
53 */
54
55 librados::IoCtx& m_io_ctx;
56 std::string m_global_image_id;
57 std::string m_image_id;
58 Context* m_on_finish;
59
60 CephContext* m_cct;
61
62 void remove_mirror_image();
63 void handle_remove_mirror_image(int r);
64
65 void notify_mirroring_watcher();
66 void handle_notify_mirroring_watcher(int r);
67
68 void finish(int r);
69
70 };
71
72 } // namespace mirror
73 } // namespace librbd
74
75 extern template class librbd::mirror::ImageRemoveRequest<librbd::ImageCtx>;
76
77 #endif // CEPH_LIBRBD_MIRROR_IMAGE_REMOVE_REQUEST_H