]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_CACHE_IMAGE_CACHE | |
5 | #define CEPH_LIBRBD_CACHE_IMAGE_CACHE | |
6 | ||
7 | #include "include/buffer_fwd.h" | |
8 | #include "include/int_types.h" | |
9 | #include <vector> | |
10 | ||
11 | class Context; | |
12 | ||
13 | namespace librbd { | |
14 | namespace cache { | |
15 | ||
16 | /** | |
17 | * client-side, image extent cache interface | |
18 | */ | |
19 | struct ImageCache { | |
20 | typedef std::vector<std::pair<uint64_t,uint64_t> > Extents; | |
21 | ||
22 | virtual ~ImageCache() { | |
23 | } | |
24 | ||
25 | /// client AIO methods | |
26 | virtual void aio_read(Extents&& image_extents, ceph::bufferlist* bl, | |
27 | int fadvise_flags, Context *on_finish) = 0; | |
28 | virtual void aio_write(Extents&& image_extents, ceph::bufferlist&& bl, | |
29 | int fadvise_flags, Context *on_finish) = 0; | |
30 | virtual void aio_discard(uint64_t offset, uint64_t length, | |
31 | bool skip_partial_discard, Context *on_finish) = 0; | |
32 | virtual void aio_flush(Context *on_finish) = 0; | |
33 | virtual void aio_writesame(uint64_t offset, uint64_t length, | |
34 | ceph::bufferlist&& bl, | |
35 | int fadvise_flags, Context *on_finish) = 0; | |
c07f9fc5 FG |
36 | virtual void aio_compare_and_write(Extents&& image_extents, |
37 | ceph::bufferlist&& cmp_bl, | |
38 | ceph::bufferlist&& bl, | |
39 | uint64_t *mismatch_offset, | |
40 | int fadvise_flags, | |
41 | Context *on_finish) = 0; | |
7c673cae FG |
42 | |
43 | /// internal state methods | |
44 | virtual void init(Context *on_finish) = 0; | |
45 | virtual void shut_down(Context *on_finish) = 0; | |
46 | ||
47 | virtual void invalidate(Context *on_finish) = 0; | |
48 | virtual void flush(Context *on_finish) = 0; | |
49 | ||
50 | }; | |
51 | ||
52 | } // namespace cache | |
53 | } // namespace librbd | |
54 | ||
55 | #endif // CEPH_LIBRBD_CACHE_IMAGE_CACHE |