]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/io/ObjectDispatch.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / librbd / io / ObjectDispatch.h
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(
37 const std::string &oid, uint64_t object_no, uint64_t object_off,
38 uint64_t object_len, librados::snap_t snap_id, int op_flags,
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(
45 const std::string &oid, uint64_t object_no, uint64_t object_off,
46 uint64_t object_len, const ::SnapContext &snapc, int discard_flags,
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(
52 const std::string &oid, uint64_t object_no, uint64_t object_off,
53 ceph::bufferlist&& data, const ::SnapContext &snapc, int op_flags,
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(
59 const std::string &oid, uint64_t object_no, uint64_t object_off,
60 uint64_t object_len, Extents&& buffer_extents, ceph::bufferlist&& data,
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(
67 const std::string &oid, uint64_t object_no, uint64_t object_off,
68 ceph::bufferlist&& cmp_data, ceph::bufferlist&& write_data,
69 const ::SnapContext &snapc, int op_flags,
70 const ZTracer::Trace &parent_trace, uint64_t* mismatch_offset,
71 int* object_dispatch_flags, uint64_t* journal_tid,
72 DispatchResult* dispatch_result, Context** on_finish,
73 Context* on_dispatched) override;
74
75 bool flush(
76 FlushSource flush_source, const ZTracer::Trace &parent_trace,
77 DispatchResult* dispatch_result, Context** on_finish,
78 Context* on_dispatched) override {
79 return false;
80 }
81
82 bool invalidate_cache(Context* on_finish) override {
83 return false;
84 }
85 bool reset_existence_cache(Context* on_finish) override {
86 return false;
87 }
88
89 void extent_overwritten(
90 uint64_t object_no, uint64_t object_off, uint64_t object_len,
91 uint64_t journal_tid, uint64_t new_journal_tid) override {
92 }
93
94 private:
95 ImageCtxT* m_image_ctx;
96
97 };
98
99 } // namespace io
100 } // namespace librbd
101
102 extern template class librbd::io::ObjectDispatch<librbd::ImageCtx>;
103
104 #endif // CEPH_LIBRBD_IO_OBJECT_DISPATCH_H