Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / librbd / object_map / RemoveRequest.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_REMOVE_REQUEST_H
5 #define CEPH_LIBRBD_OBJECT_MAP_REMOVE_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 RemoveRequest {
22 public:
23   static RemoveRequest *create(ImageCtxT *image_ctx, Context *on_finish) {
24     return new RemoveRequest(image_ctx, on_finish);
25   }
26
27   void send();
28
29 private:
30   /**
31    * @verbatim
32    *
33    * <start>
34    *    |          .  .  .
35    *    v          v     .
36    * REMOVE_OBJECT_MAP   . (for every snapshot)
37    *    |          .     .
38    *    v          .  .  .
39    * <finis>
40    *
41    * @endverbatim
42    */
43
44   RemoveRequest(ImageCtxT *image_ctx, Context *on_finish);
45
46   ImageCtxT *m_image_ctx;
47   Context *m_on_finish;
48
49   int m_error_result = 0;
50   int m_ref_counter = 0;
51   mutable Mutex m_lock;
52
53   void send_remove_object_map();
54   Context *handle_remove_object_map(int *result);
55 };
56
57 } // namespace object_map
58 } // namespace librbd
59
60 extern template class librbd::object_map::RemoveRequest<librbd::ImageCtx>;
61
62 #endif // CEPH_LIBRBD_OBJECT_MAP_REMOVE_REQUEST_H