]>
Commit | Line | Data |
---|---|---|
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_JOURNAL_REMOVE_REQUEST_H | |
5 | #define CEPH_LIBRBD_JOURNAL_REMOVE_REQUEST_H | |
6 | ||
7 | #include "include/int_types.h" | |
8 | #include "include/buffer.h" | |
9 | #include "include/rados/librados.hpp" | |
10 | #include "include/rbd/librbd.hpp" | |
7c673cae FG |
11 | #include "librbd/ImageCtx.h" |
12 | #include "journal/Journaler.h" | |
13 | #include "librbd/journal/TypeTraits.h" | |
14 | ||
15 | using librados::IoCtx; | |
16 | using journal::Journaler; | |
17 | ||
18 | class Context; | |
19 | class ContextWQ; | |
20 | class SafeTimer; | |
21 | ||
22 | namespace journal { | |
23 | class Journaler; | |
24 | } | |
25 | ||
26 | namespace librbd { | |
27 | ||
28 | class ImageCtx; | |
29 | ||
30 | namespace journal { | |
31 | ||
32 | template<typename ImageCtxT = ImageCtx> | |
33 | class RemoveRequest { | |
34 | public: | |
35 | static RemoveRequest *create(IoCtx &ioctx, const std::string &image_id, | |
36 | const std::string &client_id, | |
37 | ContextWQ *op_work_queue, Context *on_finish) { | |
38 | return new RemoveRequest(ioctx, image_id, client_id, | |
39 | op_work_queue, on_finish); | |
40 | } | |
41 | ||
42 | void send(); | |
43 | ||
44 | private: | |
45 | typedef typename TypeTraits<ImageCtxT>::Journaler Journaler; | |
46 | ||
47 | RemoveRequest(IoCtx &ioctx, const std::string &image_id, | |
48 | const std::string &client_id, | |
49 | ContextWQ *op_work_queue, Context *on_finish); | |
50 | ||
51 | IoCtx &m_ioctx; | |
52 | std::string m_image_id; | |
53 | std::string m_image_client_id; | |
54 | ContextWQ *m_op_work_queue; | |
55 | Context *m_on_finish; | |
56 | ||
57 | CephContext *m_cct; | |
58 | Journaler *m_journaler; | |
59 | SafeTimer *m_timer; | |
9f95a23c | 60 | ceph::mutex *m_timer_lock; |
7c673cae FG |
61 | int m_r_saved; |
62 | ||
63 | void stat_journal(); | |
64 | Context *handle_stat_journal(int *result); | |
65 | ||
66 | void init_journaler(); | |
67 | Context *handle_init_journaler(int *result); | |
68 | ||
69 | void remove_journal(); | |
70 | Context *handle_remove_journal(int *result); | |
71 | ||
72 | void shut_down_journaler(int r); | |
73 | Context *handle_journaler_shutdown(int *result); | |
74 | }; | |
75 | ||
76 | } // namespace journal | |
77 | } // namespace librbd | |
78 | ||
79 | extern template class librbd::journal::RemoveRequest<librbd::ImageCtx>; | |
80 | ||
81 | #endif // CEPH_LIBRBD_JOURNAL_REMOVE_REQUEST_H |