]>
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_RBD_MIRROR_POOL_WATCHER_REFRESH_IMAGES_REQUEST_H | |
5 | #define CEPH_RBD_MIRROR_POOL_WATCHER_REFRESH_IMAGES_REQUEST_H | |
6 | ||
7 | #include "include/buffer.h" | |
8 | #include "include/rados/librados.hpp" | |
11fdf7f2 | 9 | #include "tools/rbd_mirror/Types.h" |
7c673cae FG |
10 | #include <string> |
11 | ||
12 | struct Context; | |
13 | ||
14 | namespace librbd { struct ImageCtx; } | |
15 | ||
16 | namespace rbd { | |
17 | namespace mirror { | |
18 | namespace pool_watcher { | |
19 | ||
20 | template <typename ImageCtxT = librbd::ImageCtx> | |
21 | class RefreshImagesRequest { | |
22 | public: | |
23 | static RefreshImagesRequest *create(librados::IoCtx &remote_io_ctx, | |
24 | ImageIds *image_ids, Context *on_finish) { | |
25 | return new RefreshImagesRequest(remote_io_ctx, image_ids, on_finish); | |
26 | } | |
27 | ||
28 | RefreshImagesRequest(librados::IoCtx &remote_io_ctx, ImageIds *image_ids, | |
29 | Context *on_finish) | |
30 | : m_remote_io_ctx(remote_io_ctx), m_image_ids(image_ids), | |
31 | m_on_finish(on_finish) { | |
32 | } | |
33 | ||
34 | void send(); | |
35 | ||
36 | private: | |
37 | /** | |
38 | * @verbatim | |
39 | * | |
40 | * <start> | |
41 | * | | |
42 | * | /-------------\ | |
43 | * | | | | |
44 | * v v | (more images) | |
45 | * MIRROR_IMAGE_LIST ---/ | |
46 | * | | |
47 | * v | |
48 | * <finish> | |
49 | * | |
50 | * @endverbatim | |
51 | */ | |
52 | ||
53 | librados::IoCtx &m_remote_io_ctx; | |
54 | ImageIds *m_image_ids; | |
55 | Context *m_on_finish; | |
56 | ||
57 | bufferlist m_out_bl; | |
58 | std::string m_start_after; | |
59 | ||
60 | void mirror_image_list(); | |
61 | void handle_mirror_image_list(int r); | |
62 | ||
63 | void finish(int r); | |
64 | ||
65 | }; | |
66 | ||
67 | } // namespace pool_watcher | |
68 | } // namespace mirror | |
69 | } // namespace rbd | |
70 | ||
71 | extern template class rbd::mirror::pool_watcher::RefreshImagesRequest<librbd::ImageCtx>; | |
72 | ||
73 | #endif // CEPH_RBD_MIRROR_POOL_WATCHER_REFRESH_IMAGES_REQUEST_H |