]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/plugin/Api.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / librbd / plugin / Api.h
CommitLineData
f67539c2
TL
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_PLUGIN_API_H
5#define CEPH_LIBRBD_PLUGIN_API_H
6
7#include "common/ceph_mutex.h"
8#include "include/common_fwd.h"
9#include "include/int_types.h"
10#include "include/rados/librados.hpp"
11#include "librbd/io/Types.h"
12#include "librbd/io/ReadResult.h"
13
14namespace ZTracer { struct Trace; }
15
16class SafeTimer;
17
18namespace librbd {
19
20namespace io {
21class AioCompletion;
22class C_AioRequest;
23}
24
25struct ImageCtx;
26
27namespace plugin {
28
29template <typename ImageCtxT>
30struct Api {
31 using Extents = librbd::io::Extents;
32
33 Api() {}
34 virtual ~Api() {}
35
36 virtual void read_parent(
37 ImageCtxT *image_ctx, uint64_t object_no, io::ReadExtents* extents,
38 librados::snap_t snap_id, const ZTracer::Trace &trace,
39 Context* on_finish);
40
41 virtual void execute_image_metadata_set(
42 ImageCtxT *image_ctx,
43 const std::string &key,
44 const std::string &value,
45 Context *on_finish);
46
47 virtual void execute_image_metadata_remove(
48 ImageCtxT *image_ctx,
49 const std::string &key,
50 Context *on_finish);
51
52 virtual void get_image_timer_instance(
53 CephContext *cct, SafeTimer **timer,
54 ceph::mutex **timer_lock);
55
56 virtual bool test_image_features(
57 ImageCtxT *image_ctx,
58 uint64_t features);
59
60 virtual void update_aio_comp(
61 io::AioCompletion* aio_comp,
62 uint32_t request_count,
63 io::ReadResult& read_result,
64 io::Extents &image_extents);
65
66 virtual void update_aio_comp(
67 io::AioCompletion* aio_comp,
68 uint32_t request_count);
69
70 virtual io::ReadResult::C_ImageReadRequest* create_image_read_request(
71 io::AioCompletion* aio_comp, uint64_t buffer_offset,
72 const Extents& image_extents);
73
74 virtual io::C_AioRequest* create_aio_request(io::AioCompletion* aio_comp);
75
76private:
77 void start_in_flight_io(io::AioCompletion* aio_comp);
78};
79
80} // namespace plugin
81} // namespace librbd
82
83extern template class librbd::plugin::Api<librbd::ImageCtx>;
84
85#endif // CEPH_LIBRBD_PLUGIN_API_H