1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H
5 #define CEPH_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H
7 #include "gmock/gmock.h"
8 #include "include/Context.h"
9 #include "librbd/io/ImageDispatchInterface.h"
10 #include "librbd/io/Types.h"
17 struct MockImageDispatch
: public ImageDispatchInterface
{
19 MOCK_CONST_METHOD0(get_dispatch_layer
, ImageDispatchLayer());
21 MOCK_METHOD1(shut_down
, void(Context
*));
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
{
34 AioCompletion
* aio_comp
, Extents
&&image_extents
, bufferlist
&&bl
,
35 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
{
43 AioCompletion
* aio_comp
, Extents
&&image_extents
,
44 uint32_t discard_granularity_bytes
, const ZTracer::Trace
&parent_trace
,
45 uint64_t tid
, std::atomic
<uint32_t>* image_dispatch_flags
,
46 DispatchResult
* dispatch_result
, Context
** on_finish
,
47 Context
* on_dispatched
) override
{
52 AioCompletion
* aio_comp
, Extents
&&image_extents
, bufferlist
&&bl
,
53 int op_flags
, const ZTracer::Trace
&parent_trace
,
54 uint64_t tid
, std::atomic
<uint32_t>* image_dispatch_flags
,
55 DispatchResult
* dispatch_result
, Context
** on_finish
,
56 Context
* on_dispatched
) override
{
60 bool compare_and_write(
61 AioCompletion
* aio_comp
, Extents
&&image_extents
,
62 bufferlist
&&cmp_bl
, bufferlist
&&bl
, uint64_t *mismatch_offset
,
63 int op_flags
, const ZTracer::Trace
&parent_trace
,
64 uint64_t tid
, std::atomic
<uint32_t>* image_dispatch_flags
,
65 DispatchResult
* dispatch_result
, Context
** on_finish
,
66 Context
* on_dispatched
) override
{
71 AioCompletion
* aio_comp
, FlushSource flush_source
,
72 const ZTracer::Trace
&parent_trace
, uint64_t tid
,
73 std::atomic
<uint32_t>* image_dispatch_flags
,
74 DispatchResult
* dispatch_result
, Context
** on_finish
,
75 Context
* on_dispatched
) override
{
80 AioCompletion
* aio_comp
, Extents
&& image_extents
, SnapIds
&& snap_ids
,
81 int list_snaps_flags
, SnapshotDelta
* snapshot_delta
,
82 const ZTracer::Trace
&parent_trace
, uint64_t tid
,
83 std::atomic
<uint32_t>* image_dispatch_flags
,
84 DispatchResult
* dispatch_result
, Context
** on_finish
,
85 Context
* on_dispatched
) override
{
89 bool invalidate_cache(Context
* on_finish
) override
{
98 #endif // CEPH_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H