blob: 01ab31171950bdfaacc28a3879949f9db505d952 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef RBD_MIRROR_IMAGE_REPLAYER_OPEN_IMAGE_REQUEST_H
#define RBD_MIRROR_IMAGE_REPLAYER_OPEN_IMAGE_REQUEST_H
#include "include/int_types.h"
#include "librbd/ImageCtx.h"
#include <string>
class Context;
namespace librbd { class ImageCtx; }
namespace rbd {
namespace mirror {
namespace image_replayer {
template <typename ImageCtxT = librbd::ImageCtx>
class OpenImageRequest {
public:
static OpenImageRequest* create(librados::IoCtx &io_ctx,
ImageCtxT **image_ctx,
const std::string &image_id,
bool read_only, Context *on_finish) {
return new OpenImageRequest(io_ctx, image_ctx, image_id, read_only,
on_finish);
}
OpenImageRequest(librados::IoCtx &io_ctx, ImageCtxT **image_ctx,
const std::string &image_id, bool read_only,
Context *on_finish);
void send();
private:
/**
* @verbatim
*
* <start>
* |
* v
* OPEN_IMAGE
* |
* v
* <finish>
*
* @endverbatim
*/
librados::IoCtx &m_io_ctx;
ImageCtxT **m_image_ctx;
std::string m_image_id;
bool m_read_only;
Context *m_on_finish;
void send_open_image();
void handle_open_image(int r);
void send_close_image(int r);
void handle_close_image(int r);
void finish(int r);
};
} // namespace image_replayer
} // namespace mirror
} // namespace rbd
extern template class rbd::mirror::image_replayer::OpenImageRequest<librbd::ImageCtx>;
#endif // RBD_MIRROR_IMAGE_REPLAYER_OPEN_IMAGE_REQUEST_H
|