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