]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/mirror/GetInfoRequest.h
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / librbd / mirror / GetInfoRequest.h
CommitLineData
7c673cae
FG
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_GET_INFO_REQUEST_H
5#define CEPH_LIBRBD_MIRROR_GET_INFO_REQUEST_H
6
7#include "include/buffer.h"
8#include "librbd/mirror/Types.h"
9#include <string>
10
11struct Context;
12namespace cls { namespace rbd { struct MirrorImage; } }
13
14namespace librbd {
15
16struct ImageCtx;
17
18namespace mirror {
19
20template <typename ImageCtxT = librbd::ImageCtx>
21class GetInfoRequest {
22public:
23 static GetInfoRequest *create(ImageCtxT &image_ctx,
24 cls::rbd::MirrorImage *mirror_image,
25 PromotionState *promotion_state,
26 Context *on_finish) {
27 return new GetInfoRequest(image_ctx, mirror_image, promotion_state,
28 on_finish);
29 }
30
31 GetInfoRequest(ImageCtxT &image_ctx, cls::rbd::MirrorImage *mirror_image,
32 PromotionState *promotion_state, Context *on_finish)
33 : m_image_ctx(image_ctx), m_mirror_image(mirror_image),
34 m_promotion_state(promotion_state), m_on_finish(on_finish) {
35 }
36
37 void send();
38
39private:
40 /**
41 * @verbatim
42 *
43 * <start>
44 * |
45 * v
7c673cae
FG
46 * GET_MIRROR_IMAGE
47 * |
48 * v
49 * GET_TAG_OWNER
50 * |
51 * v
52 * <finish>
53 *
54 * @endverbatim
55 */
56
57 ImageCtxT &m_image_ctx;
58 cls::rbd::MirrorImage *m_mirror_image;
59 PromotionState *m_promotion_state;
60 Context *m_on_finish;
61
62 bufferlist m_out_bl;
63 std::string m_mirror_uuid;
64
7c673cae
FG
65 void get_mirror_image();
66 void handle_get_mirror_image(int r);
67
68 void get_tag_owner();
69 void handle_get_tag_owner(int r);
70
71 void finish(int r);
72
73};
74
75} // namespace mirror
76} // namespace librbd
77
78extern template class librbd::mirror::GetInfoRequest<librbd::ImageCtx>;
79
80#endif // CEPH_LIBRBD_MIRROR_GET_INFO_REQUEST_H
81