]>
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_OBJECT_MAP_UPDATE_REQUEST_H | |
5 | #define CEPH_LIBRBD_OBJECT_MAP_UPDATE_REQUEST_H | |
6 | ||
7 | #include "include/int_types.h" | |
8 | #include "librbd/object_map/Request.h" | |
9 | #include "common/bit_vector.hpp" | |
10 | #include <boost/optional.hpp> | |
11 | ||
12 | class Context; | |
13 | ||
14 | namespace librbd { | |
15 | ||
16 | class ImageCtx; | |
17 | ||
18 | namespace object_map { | |
19 | ||
20 | template <typename ImageCtxT = librbd::ImageCtx> | |
21 | class UpdateRequest : public Request { | |
22 | public: | |
23 | static UpdateRequest *create(ImageCtx &image_ctx, | |
24 | ceph::BitVector<2> *object_map, | |
25 | uint64_t snap_id, uint64_t start_object_no, | |
26 | uint64_t end_object_no, uint8_t new_state, | |
27 | const boost::optional<uint8_t> ¤t_state, | |
28 | Context *on_finish) { | |
29 | return new UpdateRequest(image_ctx, object_map, snap_id, start_object_no, | |
30 | end_object_no, new_state, current_state, | |
31 | on_finish); | |
32 | } | |
33 | ||
34 | UpdateRequest(ImageCtx &image_ctx, ceph::BitVector<2> *object_map, | |
35 | uint64_t snap_id, uint64_t start_object_no, | |
36 | uint64_t end_object_no, uint8_t new_state, | |
37 | const boost::optional<uint8_t> ¤t_state, | |
38 | Context *on_finish) | |
39 | : Request(image_ctx, snap_id, on_finish), m_object_map(*object_map), | |
40 | m_start_object_no(start_object_no), m_end_object_no(end_object_no), | |
41 | m_new_state(new_state), m_current_state(current_state) | |
42 | { | |
43 | } | |
44 | ||
45 | void send() override; | |
46 | ||
47 | protected: | |
48 | void finish_request() override; | |
49 | ||
50 | private: | |
51 | ceph::BitVector<2> &m_object_map; | |
52 | uint64_t m_start_object_no; | |
53 | uint64_t m_end_object_no; | |
54 | uint8_t m_new_state; | |
55 | boost::optional<uint8_t> m_current_state; | |
56 | }; | |
57 | ||
58 | } // namespace object_map | |
59 | } // namespace librbd | |
60 | ||
61 | extern template class librbd::object_map::UpdateRequest<librbd::ImageCtx>; | |
62 | ||
63 | #endif // CEPH_LIBRBD_OBJECT_MAP_UPDATE_REQUEST_H |