]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
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_IO_OBJECT_DISPATCH_H | |
5 | #define CEPH_LIBRBD_IO_OBJECT_DISPATCH_H | |
6 | ||
7 | #include "include/int_types.h" | |
8 | #include "include/buffer.h" | |
9 | #include "include/rados/librados.hpp" | |
10 | #include "common/snap_types.h" | |
11 | #include "common/zipkin_trace.h" | |
12 | #include "librbd/io/Types.h" | |
13 | #include "librbd/io/ObjectDispatchInterface.h" | |
14 | ||
15 | struct Context; | |
16 | ||
17 | namespace librbd { | |
18 | ||
19 | struct ImageCtx; | |
20 | ||
21 | namespace io { | |
22 | ||
23 | struct AioCompletion; | |
24 | ||
25 | template <typename ImageCtxT = librbd::ImageCtx> | |
26 | class ObjectDispatch : public ObjectDispatchInterface { | |
27 | public: | |
28 | ObjectDispatch(ImageCtxT* image_ctx); | |
29 | ||
30 | ObjectDispatchLayer get_object_dispatch_layer() const override { | |
31 | return OBJECT_DISPATCH_LAYER_CORE; | |
32 | } | |
33 | ||
34 | void shut_down(Context* on_finish) override; | |
35 | ||
36 | bool read( | |
9f95a23c TL |
37 | uint64_t object_no, uint64_t object_off, uint64_t object_len, |
38 | librados::snap_t snap_id, int op_flags, | |
11fdf7f2 TL |
39 | const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data, |
40 | ExtentMap* extent_map, int* object_dispatch_flags, | |
41 | DispatchResult* dispatch_result, Context** on_finish, | |
42 | Context* on_dispatched) override; | |
43 | ||
44 | bool discard( | |
9f95a23c TL |
45 | uint64_t object_no, uint64_t object_off, uint64_t object_len, |
46 | const ::SnapContext &snapc, int discard_flags, | |
11fdf7f2 TL |
47 | const ZTracer::Trace &parent_trace, int* object_dispatch_flags, |
48 | uint64_t* journal_tid, DispatchResult* dispatch_result, | |
49 | Context** on_finish, Context* on_dispatched) override; | |
50 | ||
51 | bool write( | |
9f95a23c TL |
52 | uint64_t object_no, uint64_t object_off, ceph::bufferlist&& data, |
53 | const ::SnapContext &snapc, int op_flags, | |
11fdf7f2 TL |
54 | const ZTracer::Trace &parent_trace, int* object_dispatch_flags, |
55 | uint64_t* journal_tid, DispatchResult* dispatch_result, | |
56 | Context** on_finish, Context* on_dispatched) override; | |
57 | ||
58 | bool write_same( | |
9f95a23c TL |
59 | uint64_t object_no, uint64_t object_off, uint64_t object_len, |
60 | LightweightBufferExtents&& buffer_extents, ceph::bufferlist&& data, | |
11fdf7f2 TL |
61 | const ::SnapContext &snapc, int op_flags, |
62 | const ZTracer::Trace &parent_trace, int* object_dispatch_flags, | |
63 | uint64_t* journal_tid, DispatchResult* dispatch_result, | |
64 | Context** on_finish, Context* on_dispatched) override; | |
65 | ||
66 | bool compare_and_write( | |
9f95a23c TL |
67 | uint64_t object_no, uint64_t object_off, ceph::bufferlist&& cmp_data, |
68 | ceph::bufferlist&& write_data, const ::SnapContext &snapc, int op_flags, | |
11fdf7f2 TL |
69 | const ZTracer::Trace &parent_trace, uint64_t* mismatch_offset, |
70 | int* object_dispatch_flags, uint64_t* journal_tid, | |
71 | DispatchResult* dispatch_result, Context** on_finish, | |
72 | Context* on_dispatched) override; | |
73 | ||
74 | bool flush( | |
75 | FlushSource flush_source, const ZTracer::Trace &parent_trace, | |
9f95a23c TL |
76 | uint64_t* journal_tid, DispatchResult* dispatch_result, |
77 | Context** on_finish, Context* on_dispatched) override { | |
11fdf7f2 TL |
78 | return false; |
79 | } | |
80 | ||
81 | bool invalidate_cache(Context* on_finish) override { | |
82 | return false; | |
83 | } | |
84 | bool reset_existence_cache(Context* on_finish) override { | |
85 | return false; | |
86 | } | |
87 | ||
88 | void extent_overwritten( | |
89 | uint64_t object_no, uint64_t object_off, uint64_t object_len, | |
90 | uint64_t journal_tid, uint64_t new_journal_tid) override { | |
91 | } | |
92 | ||
93 | private: | |
94 | ImageCtxT* m_image_ctx; | |
95 | ||
96 | }; | |
97 | ||
98 | } // namespace io | |
99 | } // namespace librbd | |
100 | ||
101 | extern template class librbd::io::ObjectDispatch<librbd::ImageCtx>; | |
102 | ||
103 | #endif // CEPH_LIBRBD_IO_OBJECT_DISPATCH_H |