1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_IMAGE_OPEN_REQUEST_H
5 #define CEPH_LIBRBD_IMAGE_OPEN_REQUEST_H
7 #include "include/buffer.h"
19 template <typename ImageCtxT = ImageCtx>
22 static OpenRequest *create(ImageCtxT *image_ctx, bool skip_open_parent,
24 return new OpenRequest(image_ctx, skip_open_parent, on_finish);
36 * |-----> V1_DETECT_HEADER
38 * | \-------------------------------\
40 * \-----> V2_DETECT_HEADER |
46 * V2_GET_NAME_FROM_TRASH |
49 * V2_GET_IMMUTABLE_METADATA |
52 * V2_GET_STRIPE_UNIT_COUNT |
55 * V2_GET_CREATE_TIMESTAMP |
61 * /---> V2_APPLY_METADATA -------------> REGISTER_WATCH (skip if
67 * SET_SNAP (skip if no snap)
73 * * * * * * * > CLOSE ------------------------/
78 OpenRequest(ImageCtxT *image_ctx, bool skip_open_parent, Context *on_finish);
80 ImageCtxT *m_image_ctx;
81 bool m_skip_open_parent_image;
87 std::string m_last_metadata_key;
88 std::map<std::string, bufferlist> m_metadata;
90 void send_v1_detect_header();
91 Context *handle_v1_detect_header(int *result);
93 void send_v2_detect_header();
94 Context *handle_v2_detect_header(int *result);
96 void send_v2_get_id();
97 Context *handle_v2_get_id(int *result);
99 void send_v2_get_name();
100 Context *handle_v2_get_name(int *result);
102 void send_v2_get_name_from_trash();
103 Context *handle_v2_get_name_from_trash(int *result);
105 void send_v2_get_immutable_metadata();
106 Context *handle_v2_get_immutable_metadata(int *result);
108 void send_v2_get_stripe_unit_count();
109 Context *handle_v2_get_stripe_unit_count(int *result);
111 void send_v2_get_create_timestamp();
112 Context *handle_v2_get_create_timestamp(int *result);
114 void send_v2_get_data_pool();
115 Context *handle_v2_get_data_pool(int *result);
117 void send_v2_apply_metadata();
118 Context *handle_v2_apply_metadata(int *result);
120 void send_register_watch();
121 Context *handle_register_watch(int *result);
124 Context *handle_refresh(int *result);
126 Context *send_set_snap(int *result);
127 Context *handle_set_snap(int *result);
129 void send_close_image(int error_result);
130 Context *handle_close_image(int *result);
135 } // namespace librbd
137 extern template class librbd::image::OpenRequest<librbd::ImageCtx>;
139 #endif // CEPH_LIBRBD_IMAGE_OPEN_REQUEST_H