]>
Commit | Line | Data |
---|---|---|
f67539c2 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_PLUGIN_API_H | |
5 | #define CEPH_LIBRBD_PLUGIN_API_H | |
6 | ||
7 | #include "common/ceph_mutex.h" | |
8 | #include "include/common_fwd.h" | |
9 | #include "include/int_types.h" | |
10 | #include "include/rados/librados.hpp" | |
11 | #include "librbd/io/Types.h" | |
12 | #include "librbd/io/ReadResult.h" | |
13 | ||
14 | namespace ZTracer { struct Trace; } | |
15 | ||
16 | class SafeTimer; | |
17 | ||
18 | namespace librbd { | |
19 | ||
20 | namespace io { | |
21 | class AioCompletion; | |
22 | class C_AioRequest; | |
23 | } | |
24 | ||
25 | struct ImageCtx; | |
26 | ||
27 | namespace plugin { | |
28 | ||
29 | template <typename ImageCtxT> | |
30 | struct Api { | |
31 | using Extents = librbd::io::Extents; | |
32 | ||
33 | Api() {} | |
34 | virtual ~Api() {} | |
35 | ||
36 | virtual void read_parent( | |
37 | ImageCtxT *image_ctx, uint64_t object_no, io::ReadExtents* extents, | |
38 | librados::snap_t snap_id, const ZTracer::Trace &trace, | |
39 | Context* on_finish); | |
40 | ||
41 | virtual void execute_image_metadata_set( | |
42 | ImageCtxT *image_ctx, | |
43 | const std::string &key, | |
44 | const std::string &value, | |
45 | Context *on_finish); | |
46 | ||
47 | virtual void execute_image_metadata_remove( | |
48 | ImageCtxT *image_ctx, | |
49 | const std::string &key, | |
50 | Context *on_finish); | |
51 | ||
52 | virtual void get_image_timer_instance( | |
53 | CephContext *cct, SafeTimer **timer, | |
54 | ceph::mutex **timer_lock); | |
55 | ||
56 | virtual bool test_image_features( | |
57 | ImageCtxT *image_ctx, | |
58 | uint64_t features); | |
59 | ||
60 | virtual void update_aio_comp( | |
61 | io::AioCompletion* aio_comp, | |
62 | uint32_t request_count, | |
63 | io::ReadResult& read_result, | |
64 | io::Extents &image_extents); | |
65 | ||
66 | virtual void update_aio_comp( | |
67 | io::AioCompletion* aio_comp, | |
68 | uint32_t request_count); | |
69 | ||
70 | virtual io::ReadResult::C_ImageReadRequest* create_image_read_request( | |
71 | io::AioCompletion* aio_comp, uint64_t buffer_offset, | |
72 | const Extents& image_extents); | |
73 | ||
74 | virtual io::C_AioRequest* create_aio_request(io::AioCompletion* aio_comp); | |
75 | ||
76 | private: | |
77 | void start_in_flight_io(io::AioCompletion* aio_comp); | |
78 | }; | |
79 | ||
80 | } // namespace plugin | |
81 | } // namespace librbd | |
82 | ||
83 | extern template class librbd::plugin::Api<librbd::ImageCtx>; | |
84 | ||
85 | #endif // CEPH_LIBRBD_PLUGIN_API_H |