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 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
{
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
{
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
{
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
{
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
{
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
{
90 bool invalidate_cache(Context
* on_finish
) override
{
99 #endif // CEPH_TEST_LIBRBD_MOCK_IO_IMAGE_DISPATCH_H