]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/librbd/mock/io/MockImageDispatch.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / test / librbd / mock / io / MockImageDispatch.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_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H
5 #define CEPH_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H
6
7 #include "gmock/gmock.h"
8 #include "include/Context.h"
9 #include "librbd/io/ImageDispatchInterface.h"
10 #include "librbd/io/Types.h"
11
12 class Context;
13
14 namespace librbd {
15 namespace io {
16
17 struct MockImageDispatch : public ImageDispatchInterface {
18 public:
19 MOCK_CONST_METHOD0(get_dispatch_layer, ImageDispatchLayer());
20
21 MOCK_METHOD1(shut_down, void(Context*));
22
23 bool read(
24 AioCompletion* aio_comp, Extents &&image_extents,
25 ReadResult &&read_result, IOContext io_context, int op_flags,
26 int read_flags, const ZTracer::Trace &parent_trace, uint64_t tid,
27 std::atomic<uint32_t>* image_dispatch_flags,
28 DispatchResult* dispatch_result, Context** on_finish,
29 Context* on_dispatched) override {
30 return false;
31 }
32
33 bool write(
34 AioCompletion* aio_comp, Extents &&image_extents, bufferlist &&bl,
35 IOContext io_context, int op_flags, const ZTracer::Trace &parent_trace,
36 uint64_t tid, std::atomic<uint32_t>* image_dispatch_flags,
37 DispatchResult* dispatch_result, Context** on_finish,
38 Context* on_dispatched) override {
39 return false;
40 }
41
42 bool discard(
43 AioCompletion* aio_comp, Extents &&image_extents,
44 uint32_t discard_granularity_bytes, IOContext io_context,
45 const ZTracer::Trace &parent_trace, uint64_t tid,
46 std::atomic<uint32_t>* image_dispatch_flags,
47 DispatchResult* dispatch_result, Context** on_finish,
48 Context* on_dispatched) override {
49 return false;
50 }
51
52 bool write_same(
53 AioCompletion* aio_comp, Extents &&image_extents, bufferlist &&bl,
54 IOContext io_context, int op_flags, const ZTracer::Trace &parent_trace,
55 uint64_t tid, std::atomic<uint32_t>* image_dispatch_flags,
56 DispatchResult* dispatch_result, Context** on_finish,
57 Context* on_dispatched) override {
58 return false;
59 }
60
61 bool compare_and_write(
62 AioCompletion* aio_comp, Extents &&image_extents, bufferlist &&cmp_bl,
63 bufferlist &&bl, uint64_t *mismatch_offset, IOContext io_context,
64 int op_flags, const ZTracer::Trace &parent_trace, uint64_t tid,
65 std::atomic<uint32_t>* image_dispatch_flags,
66 DispatchResult* dispatch_result, Context** on_finish,
67 Context* on_dispatched) override {
68 return false;
69 }
70
71 bool flush(
72 AioCompletion* aio_comp, FlushSource flush_source,
73 const ZTracer::Trace &parent_trace, uint64_t tid,
74 std::atomic<uint32_t>* image_dispatch_flags,
75 DispatchResult* dispatch_result, Context** on_finish,
76 Context* on_dispatched) override {
77 return false;
78 }
79
80 bool list_snaps(
81 AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
82 int list_snaps_flags, SnapshotDelta* snapshot_delta,
83 const ZTracer::Trace &parent_trace, uint64_t tid,
84 std::atomic<uint32_t>* image_dispatch_flags,
85 DispatchResult* dispatch_result, Context** on_finish,
86 Context* on_dispatched) override {
87 return false;
88 }
89
90 bool invalidate_cache(Context* on_finish) override {
91 return false;
92 }
93
94 };
95
96 } // namespace io
97 } // namespace librbd
98
99 #endif // CEPH_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H