]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/mirror/GetUuidRequest.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / librbd / mirror / GetUuidRequest.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_GET_UUID_REQUEST_H
5 #define CEPH_LIBRBD_MIRROR_GET_UUID_REQUEST_H
6
7 #include "include/buffer.h"
8 #include "include/rados/librados.hpp"
9 #include "cls/rbd/cls_rbd_types.h"
10
11 #include <string>
12 #include <set>
13
14 struct Context;
15
16 namespace librbd {
17
18 struct ImageCtx;
19
20 namespace mirror {
21
22 template <typename ImageCtxT = librbd::ImageCtx>
23 class GetUuidRequest {
24 public:
25 static GetUuidRequest *create(librados::IoCtx& io_ctx,
26 std::string* mirror_uuid, Context* on_finish) {
27 return new GetUuidRequest(io_ctx, mirror_uuid, on_finish);
28 }
29
30 GetUuidRequest(librados::IoCtx& io_ctx, std::string* mirror_uuid,
31 Context* on_finish);
32
33 void send();
34
35 private:
36 /**
37 * @verbatim
38 *
39 * <start>
40 * |
41 * v
42 * GET_MIRROR_UUID
43 * |
44 * v
45 * <finish>
46 *
47 * @endverbatim
48 */
49
50 librados::IoCtx m_io_ctx;
51 std::string* m_mirror_uuid;
52 Context* m_on_finish;
53
54 CephContext* m_cct;
55
56 bufferlist m_out_bl;
57
58 void get_mirror_uuid();
59 void handle_get_mirror_uuid(int r);
60
61 void finish(int r);
62 };
63
64 } // namespace mirror
65 } // namespace librbd
66
67 extern template class librbd::mirror::GetUuidRequest<librbd::ImageCtx>;
68
69 #endif // CEPH_LIBRBD_MIRROR_GET_UUID_REQUEST_H