]> git.proxmox.com Git - ceph.git/blame - ceph/src/tools/rbd_mirror/pool_watcher/RefreshImagesRequest.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / tools / rbd_mirror / pool_watcher / RefreshImagesRequest.h
CommitLineData
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
12struct Context;
13
14namespace librbd { struct ImageCtx; }
15
16namespace rbd {
17namespace mirror {
18namespace pool_watcher {
19
20template <typename ImageCtxT = librbd::ImageCtx>
21class RefreshImagesRequest {
22public:
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
36private:
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
71extern template class rbd::mirror::pool_watcher::RefreshImagesRequest<librbd::ImageCtx>;
72
73#endif // CEPH_RBD_MIRROR_POOL_WATCHER_REFRESH_IMAGES_REQUEST_H