Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / librbd / object_map / CreateRequest.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_OBJECT_MAP_CREATE_REQUEST_H
5 #define CEPH_LIBRBD_OBJECT_MAP_CREATE_REQUEST_H
6
7 #include "include/buffer.h"
8 #include "common/Mutex.h"
9 #include <map>
10 #include <string>
11
12 class Context;
13
14 namespace librbd {
15
16 class ImageCtx;
17
18 namespace object_map {
19
20 template <typename ImageCtxT = ImageCtx>
21 class CreateRequest {
22 public:
23   static CreateRequest *create(ImageCtxT *image_ctx, Context *on_finish) {
24     return new CreateRequest(image_ctx, on_finish);
25   }
26
27   void send();
28
29 private:
30   /**
31    * @verbatim
32    *
33    * <start>
34    *    |         .  .  .
35    *    v         v     .
36    * OBJECT_MAP_RESIZE  . (for every snapshot)
37    *    |         .     .
38    *    v         .  .  .
39    * <finis>
40    *
41    * @endverbatim
42    */
43
44   CreateRequest(ImageCtxT *image_ctx, Context *on_finish);
45
46   ImageCtxT *m_image_ctx;
47   Context *m_on_finish;
48
49   std::vector<uint64_t> m_snap_ids;
50
51   void send_object_map_resize();
52   Context *handle_object_map_resize(int *result);
53 };
54
55 } // namespace object_map
56 } // namespace librbd
57
58 extern template class librbd::object_map::CreateRequest<librbd::ImageCtx>;
59
60 #endif // CEPH_LIBRBD_OBJECT_MAP_CREATE_REQUEST_H