1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_IO_OBJECT_DISPATCH_H
5 #define CEPH_LIBRBD_IO_OBJECT_DISPATCH_H
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"
25 template <typename ImageCtxT
= librbd::ImageCtx
>
26 class ObjectDispatch
: public ObjectDispatchInterface
{
28 ObjectDispatch(ImageCtxT
* image_ctx
);
30 ObjectDispatchLayer
get_object_dispatch_layer() const override
{
31 return OBJECT_DISPATCH_LAYER_CORE
;
34 void shut_down(Context
* on_finish
) override
;
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
;
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
;
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
;
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
;
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
;
76 FlushSource flush_source
, const ZTracer::Trace
&parent_trace
,
77 DispatchResult
* dispatch_result
, Context
** on_finish
,
78 Context
* on_dispatched
) override
{
82 bool invalidate_cache(Context
* on_finish
) override
{
85 bool reset_existence_cache(Context
* on_finish
) override
{
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
{
95 ImageCtxT
* m_image_ctx
;
100 } // namespace librbd
102 extern template class librbd::io::ObjectDispatch
<librbd::ImageCtx
>;
104 #endif // CEPH_LIBRBD_IO_OBJECT_DISPATCH_H