]> git.proxmox.com Git - ceph.git/blob - ceph/src/tools/rbd_mirror/image_map/LoadRequest.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / tools / rbd_mirror / image_map / LoadRequest.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_MAP_LOAD_REQUEST_H
5 #define CEPH_RBD_MIRROR_IMAGE_MAP_LOAD_REQUEST_H
6
7 #include "cls/rbd/cls_rbd_types.h"
8 #include "include/rados/librados.hpp"
9
10 class Context;
11
12 namespace librbd { class ImageCtx; }
13
14 namespace rbd {
15 namespace mirror {
16 namespace image_map {
17
18 template<typename ImageCtxT = librbd::ImageCtx>
19 class LoadRequest {
20 public:
21 static LoadRequest *create(librados::IoCtx &ioctx,
22 std::map<std::string, cls::rbd::MirrorImageMap> *image_mapping,
23 Context *on_finish) {
24 return new LoadRequest(ioctx, image_mapping, on_finish);
25 }
26
27 void send();
28
29 private:
30 /**
31 * @verbatim
32 *
33 * <start>
34 * | . . . . . . . .
35 * v v . MAX_RETURN
36 * IMAGE_MAP_LIST. . . . . . .
37 * |
38 * v
39 * <finish>
40 *
41 * @endverbatim
42 */
43 LoadRequest(librados::IoCtx &ioctx,
44 std::map<std::string, cls::rbd::MirrorImageMap> *image_mapping,
45 Context *on_finish);
46
47 librados::IoCtx &m_ioctx;
48 std::map<std::string, cls::rbd::MirrorImageMap> *m_image_mapping;
49 Context *m_on_finish;
50
51 bufferlist m_out_bl;
52 std::string m_start_after;
53
54 void image_map_list();
55 void handle_image_map_list(int r);
56
57 void finish(int r);
58 };
59
60 } // namespace image_map
61 } // namespace mirror
62 } // namespace rbd
63
64 #endif // CEPH_RBD_MIRROR_IMAGE_MAP_LOAD_REQUEST_H