]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
7c673cae FG |
2 | // vim: ts=8 sw=2 smarttab |
3 | ||
4 | #ifndef CEPH_LIBRBD_CLS_RBD_CLIENT_H | |
5 | #define CEPH_LIBRBD_CLS_RBD_CLIENT_H | |
6 | ||
7 | #include "cls/lock/cls_lock_types.h" | |
8 | #include "cls/rbd/cls_rbd_types.h" | |
7c673cae | 9 | #include "common/snap_types.h" |
7c673cae | 10 | #include "include/types.h" |
11fdf7f2 | 11 | #include "include/rados/librados_fwd.hpp" |
7c673cae | 12 | |
7c673cae | 13 | class Context; |
11fdf7f2 | 14 | namespace ceph { template <uint8_t> class BitVector; } |
7c673cae FG |
15 | |
16 | namespace librbd { | |
11fdf7f2 TL |
17 | namespace cls_client { |
18 | ||
19 | // low-level interface (mainly for testing) | |
20 | void create_image(librados::ObjectWriteOperation *op, uint64_t size, | |
21 | uint8_t order, uint64_t features, | |
22 | const std::string &object_prefix, int64_t data_pool_id); | |
23 | int create_image(librados::IoCtx *ioctx, const std::string &oid, | |
24 | uint64_t size, uint8_t order, uint64_t features, | |
25 | const std::string &object_prefix, int64_t data_pool_id); | |
26 | ||
27 | void get_features_start(librados::ObjectReadOperation *op, bool read_only); | |
28 | int get_features_finish(bufferlist::const_iterator *it, uint64_t *features, | |
29 | uint64_t *incompatible_features); | |
30 | int get_features(librados::IoCtx *ioctx, const std::string &oid, | |
31 | bool read_only, uint64_t *features, | |
32 | uint64_t *incompatible_features); | |
33 | void set_features(librados::ObjectWriteOperation *op, uint64_t features, | |
34 | uint64_t mask); | |
35 | int set_features(librados::IoCtx *ioctx, const std::string &oid, | |
36 | uint64_t features, uint64_t mask); | |
37 | ||
38 | void get_object_prefix_start(librados::ObjectReadOperation *op); | |
39 | int get_object_prefix_finish(bufferlist::const_iterator *it, | |
40 | std::string *object_prefix); | |
41 | int get_object_prefix(librados::IoCtx *ioctx, const std::string &oid, | |
42 | std::string *object_prefix); | |
43 | ||
44 | void get_data_pool_start(librados::ObjectReadOperation *op); | |
45 | int get_data_pool_finish(bufferlist::const_iterator *it, int64_t *data_pool_id); | |
46 | int get_data_pool(librados::IoCtx *ioctx, const std::string &oid, | |
47 | int64_t *data_pool_id); | |
48 | ||
49 | void get_size_start(librados::ObjectReadOperation *op, snapid_t snap_id); | |
50 | int get_size_finish(bufferlist::const_iterator *it, uint64_t *size, | |
51 | uint8_t *order); | |
52 | int get_size(librados::IoCtx *ioctx, const std::string &oid, | |
53 | snapid_t snap_id, uint64_t *size, uint8_t *order); | |
54 | int set_size(librados::IoCtx *ioctx, const std::string &oid, | |
55 | uint64_t size); | |
56 | void set_size(librados::ObjectWriteOperation *op, uint64_t size); | |
57 | ||
58 | void get_flags_start(librados::ObjectReadOperation *op, snapid_t snap_id); | |
59 | int get_flags_finish(bufferlist::const_iterator *it, uint64_t *flags); | |
60 | int get_flags(librados::IoCtx *ioctx, const std::string &oid, | |
61 | snapid_t snap_id, uint64_t *flags); | |
62 | ||
63 | void set_flags(librados::ObjectWriteOperation *op, snapid_t snap_id, | |
64 | uint64_t flags, uint64_t mask); | |
65 | ||
66 | void op_features_get_start(librados::ObjectReadOperation *op); | |
67 | int op_features_get_finish(bufferlist::const_iterator *it, | |
68 | uint64_t *op_features); | |
69 | int op_features_get(librados::IoCtx *ioctx, const std::string &oid, | |
70 | uint64_t *op_features); | |
71 | void op_features_set(librados::ObjectWriteOperation *op, | |
72 | uint64_t op_features, uint64_t mask); | |
73 | int op_features_set(librados::IoCtx *ioctx, const std::string &oid, | |
74 | uint64_t op_features, uint64_t mask); | |
75 | ||
76 | // NOTE: deprecate v1 parent APIs after mimic EOLed | |
77 | void get_parent_start(librados::ObjectReadOperation *op, snapid_t snap_id); | |
78 | int get_parent_finish(bufferlist::const_iterator *it, | |
79 | cls::rbd::ParentImageSpec *pspec, | |
80 | uint64_t *parent_overlap); | |
81 | int get_parent(librados::IoCtx *ioctx, const std::string &oid, | |
82 | snapid_t snap_id, cls::rbd::ParentImageSpec *pspec, | |
83 | uint64_t *parent_overlap); | |
84 | int set_parent(librados::IoCtx *ioctx, const std::string &oid, | |
85 | const cls::rbd::ParentImageSpec &pspec, uint64_t parent_overlap); | |
86 | void set_parent(librados::ObjectWriteOperation *op, | |
87 | const cls::rbd::ParentImageSpec &pspec, | |
88 | uint64_t parent_overlap); | |
89 | int remove_parent(librados::IoCtx *ioctx, const std::string &oid); | |
90 | void remove_parent(librados::ObjectWriteOperation *op); | |
91 | ||
92 | // v2 parent APIs | |
93 | void parent_get_start(librados::ObjectReadOperation* op); | |
94 | int parent_get_finish(bufferlist::const_iterator* it, | |
95 | cls::rbd::ParentImageSpec* parent_image_spec); | |
96 | int parent_get(librados::IoCtx* ioctx, const std::string &oid, | |
97 | cls::rbd::ParentImageSpec* parent_image_spec); | |
98 | ||
99 | void parent_overlap_get_start(librados::ObjectReadOperation* op, | |
100 | snapid_t snap_id); | |
101 | int parent_overlap_get_finish(bufferlist::const_iterator* it, | |
102 | std::optional<uint64_t>* parent_overlap); | |
103 | int parent_overlap_get(librados::IoCtx* ioctx, const std::string &oid, | |
104 | snapid_t snap_id, | |
105 | std::optional<uint64_t>* parent_overlap); | |
106 | ||
107 | void parent_attach(librados::ObjectWriteOperation* op, | |
108 | const cls::rbd::ParentImageSpec& parent_image_spec, | |
109 | uint64_t parent_overlap, bool reattach); | |
110 | int parent_attach(librados::IoCtx *ioctx, const std::string &oid, | |
111 | const cls::rbd::ParentImageSpec& parent_image_spec, | |
112 | uint64_t parent_overlap, bool reattach); | |
113 | ||
114 | void parent_detach(librados::ObjectWriteOperation* op); | |
115 | int parent_detach(librados::IoCtx *ioctx, const std::string &oid); | |
116 | ||
117 | int add_child(librados::IoCtx *ioctx, const std::string &oid, | |
118 | const cls::rbd::ParentImageSpec &pspec, | |
119 | const std::string &c_imageid); | |
120 | void add_child(librados::ObjectWriteOperation *op, | |
121 | const cls::rbd::ParentImageSpec& pspec, | |
122 | const std::string &c_imageid); | |
123 | void remove_child(librados::ObjectWriteOperation *op, | |
124 | const cls::rbd::ParentImageSpec &pspec, | |
125 | const std::string &c_imageid); | |
126 | int remove_child(librados::IoCtx *ioctx, const std::string &oid, | |
127 | const cls::rbd::ParentImageSpec &pspec, | |
128 | const std::string &c_imageid); | |
129 | void get_children_start(librados::ObjectReadOperation *op, | |
130 | const cls::rbd::ParentImageSpec &pspec); | |
131 | int get_children_finish(bufferlist::const_iterator *it, | |
132 | std::set<string> *children); | |
133 | int get_children(librados::IoCtx *ioctx, const std::string &oid, | |
134 | const cls::rbd::ParentImageSpec& pspec, set<string>& children); | |
135 | ||
136 | void snapshot_get_start(librados::ObjectReadOperation* op, | |
137 | snapid_t snap_id); | |
138 | int snapshot_get_finish(bufferlist::const_iterator* it, | |
139 | cls::rbd::SnapshotInfo* snap_info); | |
140 | int snapshot_get(librados::IoCtx *ioctx, const std::string &oid, | |
141 | snapid_t snap_id, cls::rbd::SnapshotInfo* snap_info); | |
142 | ||
143 | void snapshot_add(librados::ObjectWriteOperation *op, snapid_t snap_id, | |
144 | const std::string &snap_name, | |
145 | const cls::rbd::SnapshotNamespace &snap_namespace); | |
146 | void snapshot_remove(librados::ObjectWriteOperation *op, snapid_t snap_id); | |
147 | void snapshot_rename(librados::ObjectWriteOperation *op, | |
148 | snapid_t src_snap_id, | |
149 | const std::string &dst_name); | |
150 | void snapshot_trash_add(librados::ObjectWriteOperation *op, | |
151 | snapid_t snap_id); | |
152 | ||
153 | void get_snapcontext_start(librados::ObjectReadOperation *op); | |
154 | int get_snapcontext_finish(bufferlist::const_iterator *it, | |
155 | ::SnapContext *snapc); | |
156 | int get_snapcontext(librados::IoCtx *ioctx, const std::string &oid, | |
157 | ::SnapContext *snapc); | |
158 | ||
159 | /// NOTE: remove after Luminous is retired | |
160 | void get_snapshot_name_start(librados::ObjectReadOperation *op, | |
161 | snapid_t snap_id); | |
162 | int get_snapshot_name_finish(bufferlist::const_iterator *it, | |
163 | std::string *name); | |
164 | int get_snapshot_name(librados::IoCtx *ioctx, const std::string &oid, | |
165 | snapid_t snap_id, std::string *name); | |
166 | ||
167 | /// NOTE: remove after Luminous is retired | |
168 | void get_snapshot_timestamp_start(librados::ObjectReadOperation *op, | |
169 | snapid_t snap_id); | |
170 | int get_snapshot_timestamp_finish(bufferlist::const_iterator *it, | |
171 | utime_t *timestamp); | |
172 | int get_snapshot_timestamp(librados::IoCtx *ioctx, const std::string &oid, | |
173 | snapid_t snap_id, utime_t *timestamp); | |
174 | ||
175 | void get_all_features_start(librados::ObjectReadOperation *op); | |
176 | int get_all_features_finish(bufferlist::const_iterator *it, | |
177 | uint64_t *all_features); | |
178 | int get_all_features(librados::IoCtx *ioctx, const std::string &oid, | |
179 | uint64_t *all_features); | |
180 | ||
181 | /// NOTE: remove protection after clone v1 is retired | |
182 | void get_protection_status_start(librados::ObjectReadOperation *op, | |
183 | snapid_t snap_id); | |
184 | int get_protection_status_finish(bufferlist::const_iterator *it, | |
185 | uint8_t *protection_status); | |
186 | int get_protection_status(librados::IoCtx *ioctx, const std::string &oid, | |
187 | snapid_t snap_id, uint8_t *protection_status); | |
188 | ||
189 | int set_protection_status(librados::IoCtx *ioctx, const std::string &oid, | |
190 | snapid_t snap_id, uint8_t protection_status); | |
191 | void set_protection_status(librados::ObjectWriteOperation *op, | |
192 | snapid_t snap_id, uint8_t protection_status); | |
193 | ||
194 | int snapshot_get_limit(librados::IoCtx *ioctx, const std::string &oid, | |
195 | uint64_t *limit); | |
196 | void snapshot_set_limit(librados::ObjectWriteOperation *op, | |
197 | uint64_t limit); | |
198 | ||
199 | void get_stripe_unit_count_start(librados::ObjectReadOperation *op); | |
200 | int get_stripe_unit_count_finish(bufferlist::const_iterator *it, | |
201 | uint64_t *stripe_unit, | |
202 | uint64_t *stripe_count); | |
203 | int get_stripe_unit_count(librados::IoCtx *ioctx, const std::string &oid, | |
204 | uint64_t *stripe_unit, uint64_t *stripe_count); | |
205 | ||
206 | void set_stripe_unit_count(librados::ObjectWriteOperation *op, | |
207 | uint64_t stripe_unit, uint64_t stripe_count); | |
208 | int set_stripe_unit_count(librados::IoCtx *ioctx, const std::string &oid, | |
209 | uint64_t stripe_unit, uint64_t stripe_count); | |
210 | ||
211 | void get_create_timestamp_start(librados::ObjectReadOperation *op); | |
212 | int get_create_timestamp_finish(bufferlist::const_iterator *it, | |
213 | utime_t *timestamp); | |
214 | int get_create_timestamp(librados::IoCtx *ioctx, const std::string &oid, | |
215 | utime_t *timestamp); | |
216 | ||
217 | void get_access_timestamp_start(librados::ObjectReadOperation *op); | |
218 | int get_access_timestamp_finish(bufferlist::const_iterator *it, | |
219 | utime_t *timestamp); | |
220 | int get_access_timestamp(librados::IoCtx *ioctx, const std::string &oid, | |
221 | utime_t *timestamp); | |
222 | ||
223 | void set_access_timestamp(librados::ObjectWriteOperation *op); | |
224 | int set_access_timestamp(librados::IoCtx *ioctx, const std::string &oid); | |
225 | ||
226 | void get_modify_timestamp_start(librados::ObjectReadOperation *op); | |
227 | int get_modify_timestamp_finish(bufferlist::const_iterator *it, | |
228 | utime_t *timestamp); | |
229 | int get_modify_timestamp(librados::IoCtx *ioctx, const std::string &oid, | |
230 | utime_t *timestamp); | |
231 | ||
232 | void set_modify_timestamp(librados::ObjectWriteOperation *op); | |
233 | int set_modify_timestamp(librados::IoCtx *ioctx, const std::string &oid); | |
234 | ||
235 | int metadata_list(librados::IoCtx *ioctx, const std::string &oid, | |
236 | const std::string &start, uint64_t max_return, | |
237 | map<string, bufferlist> *pairs); | |
238 | void metadata_list_start(librados::ObjectReadOperation *op, | |
239 | const std::string &start, uint64_t max_return); | |
240 | int metadata_list_finish(bufferlist::const_iterator *it, | |
241 | std::map<std::string, bufferlist> *pairs); | |
242 | void metadata_set(librados::ObjectWriteOperation *op, | |
243 | const map<std::string, bufferlist> &data); | |
244 | int metadata_set(librados::IoCtx *ioctx, const std::string &oid, | |
245 | const map<std::string, bufferlist> &data); | |
246 | void metadata_remove(librados::ObjectWriteOperation *op, | |
247 | const std::string &key); | |
248 | int metadata_remove(librados::IoCtx *ioctx, const std::string &oid, | |
249 | const std::string &key); | |
250 | int metadata_get(librados::IoCtx *ioctx, const std::string &oid, | |
251 | const std::string &key, string *v); | |
252 | ||
253 | void child_attach(librados::ObjectWriteOperation *op, snapid_t snap_id, | |
254 | const cls::rbd::ChildImageSpec& child_image); | |
255 | int child_attach(librados::IoCtx *ioctx, const std::string &oid, | |
256 | snapid_t snap_id, | |
257 | const cls::rbd::ChildImageSpec& child_image); | |
258 | void child_detach(librados::ObjectWriteOperation *op, snapid_t snap_id, | |
259 | const cls::rbd::ChildImageSpec& child_image); | |
260 | int child_detach(librados::IoCtx *ioctx, const std::string &oid, | |
261 | snapid_t snap_id, | |
262 | const cls::rbd::ChildImageSpec& child_image); | |
263 | void children_list_start(librados::ObjectReadOperation *op, | |
264 | snapid_t snap_id); | |
265 | int children_list_finish(bufferlist::const_iterator *it, | |
266 | cls::rbd::ChildImageSpecs *child_images); | |
267 | int children_list(librados::IoCtx *ioctx, const std::string &oid, | |
268 | snapid_t snap_id, | |
269 | cls::rbd::ChildImageSpecs *child_images); | |
270 | int migration_set(librados::IoCtx *ioctx, const std::string &oid, | |
271 | const cls::rbd::MigrationSpec &migration_spec); | |
272 | void migration_set(librados::ObjectWriteOperation *op, | |
273 | const cls::rbd::MigrationSpec &migration_spec); | |
274 | int migration_set_state(librados::IoCtx *ioctx, const std::string &oid, | |
275 | cls::rbd::MigrationState state, | |
276 | const std::string &description); | |
277 | void migration_set_state(librados::ObjectWriteOperation *op, | |
278 | cls::rbd::MigrationState state, | |
279 | const std::string &description); | |
280 | void migration_get_start(librados::ObjectReadOperation *op); | |
281 | int migration_get_finish(bufferlist::const_iterator *it, | |
282 | cls::rbd::MigrationSpec *migration_spec); | |
283 | int migration_get(librados::IoCtx *ioctx, const std::string &oid, | |
284 | cls::rbd::MigrationSpec *migration_spec); | |
285 | int migration_remove(librados::IoCtx *ioctx, const std::string &oid); | |
286 | void migration_remove(librados::ObjectWriteOperation *op); | |
287 | ||
288 | // operations on rbd_id objects | |
289 | void get_id_start(librados::ObjectReadOperation *op); | |
290 | int get_id_finish(bufferlist::const_iterator *it, std::string *id); | |
291 | int get_id(librados::IoCtx *ioctx, const std::string &oid, std::string *id); | |
292 | ||
293 | void set_id(librados::ObjectWriteOperation *op, const std::string &id); | |
294 | int set_id(librados::IoCtx *ioctx, const std::string &oid, const std::string &id); | |
295 | ||
296 | // operations on rbd_directory objects | |
297 | int dir_get_id(librados::IoCtx *ioctx, const std::string &oid, | |
298 | const std::string &name, std::string *id); | |
299 | void dir_get_id_start(librados::ObjectReadOperation *op, | |
300 | const std::string &image_name); | |
301 | int dir_get_id_finish(bufferlist::const_iterator *iter, std::string *image_id); | |
302 | void dir_get_name_start(librados::ObjectReadOperation *op, | |
303 | const std::string &id); | |
304 | int dir_get_name_finish(bufferlist::const_iterator *it, std::string *name); | |
305 | int dir_get_name(librados::IoCtx *ioctx, const std::string &oid, | |
306 | const std::string &id, std::string *name); | |
307 | void dir_list_start(librados::ObjectReadOperation *op, | |
308 | const std::string &start, uint64_t max_return); | |
309 | int dir_list_finish(bufferlist::const_iterator *it, map<string, string> *images); | |
310 | int dir_list(librados::IoCtx *ioctx, const std::string &oid, | |
311 | const std::string &start, uint64_t max_return, | |
312 | map<string, string> *images); | |
313 | void dir_add_image(librados::ObjectWriteOperation *op, | |
314 | const std::string &name, const std::string &id); | |
315 | int dir_add_image(librados::IoCtx *ioctx, const std::string &oid, | |
316 | const std::string &name, const std::string &id); | |
317 | int dir_remove_image(librados::IoCtx *ioctx, const std::string &oid, | |
318 | const std::string &name, const std::string &id); | |
319 | void dir_remove_image(librados::ObjectWriteOperation *op, | |
320 | const std::string &name, const std::string &id); | |
321 | // atomic remove and add | |
322 | void dir_rename_image(librados::ObjectWriteOperation *op, | |
323 | const std::string &src, const std::string &dest, | |
324 | const std::string &id); | |
325 | void dir_state_assert(librados::ObjectOperation *op, | |
326 | cls::rbd::DirectoryState directory_state); | |
327 | int dir_state_assert(librados::IoCtx *ioctx, const std::string &oid, | |
328 | cls::rbd::DirectoryState directory_state); | |
329 | void dir_state_set(librados::ObjectWriteOperation *op, | |
330 | cls::rbd::DirectoryState directory_state); | |
331 | int dir_state_set(librados::IoCtx *ioctx, const std::string &oid, | |
332 | cls::rbd::DirectoryState directory_state); | |
333 | ||
334 | // operations on the rbd_object_map.$image_id object | |
335 | void object_map_load_start(librados::ObjectReadOperation *op); | |
336 | int object_map_load_finish(bufferlist::const_iterator *it, | |
337 | ceph::BitVector<2> *object_map); | |
338 | int object_map_load(librados::IoCtx *ioctx, const std::string &oid, | |
339 | ceph::BitVector<2> *object_map); | |
340 | void object_map_save(librados::ObjectWriteOperation *rados_op, | |
341 | const ceph::BitVector<2> &object_map); | |
342 | void object_map_resize(librados::ObjectWriteOperation *rados_op, | |
343 | uint64_t object_count, uint8_t default_state); | |
344 | void object_map_update(librados::ObjectWriteOperation *rados_op, | |
345 | uint64_t start_object_no, uint64_t end_object_no, | |
346 | uint8_t new_object_state, | |
347 | const boost::optional<uint8_t> ¤t_object_state); | |
348 | void object_map_snap_add(librados::ObjectWriteOperation *rados_op); | |
349 | void object_map_snap_remove(librados::ObjectWriteOperation *rados_op, | |
350 | const ceph::BitVector<2> &object_map); | |
351 | ||
352 | // class operations on the old format, kept for | |
353 | // backwards compatibility | |
354 | void old_snapshot_add(librados::ObjectWriteOperation *rados_op, | |
355 | snapid_t snap_id, const std::string &snap_name); | |
356 | void old_snapshot_remove(librados::ObjectWriteOperation *rados_op, | |
357 | const std::string &snap_name); | |
358 | void old_snapshot_rename(librados::ObjectWriteOperation *rados_op, | |
359 | snapid_t src_snap_id, const std::string &dst_name); | |
360 | ||
361 | void old_snapshot_list_start(librados::ObjectReadOperation *op); | |
362 | int old_snapshot_list_finish(bufferlist::const_iterator *it, | |
7c673cae FG |
363 | std::vector<string> *names, |
364 | std::vector<uint64_t> *sizes, | |
11fdf7f2 TL |
365 | ::SnapContext *snapc); |
366 | int old_snapshot_list(librados::IoCtx *ioctx, const std::string &oid, | |
367 | std::vector<string> *names, | |
368 | std::vector<uint64_t> *sizes, | |
369 | ::SnapContext *snapc); | |
370 | ||
371 | // operations on the rbd_mirroring object | |
372 | void mirror_uuid_get_start(librados::ObjectReadOperation *op); | |
373 | int mirror_uuid_get_finish(bufferlist::const_iterator *it, | |
374 | std::string *uuid); | |
375 | int mirror_uuid_get(librados::IoCtx *ioctx, std::string *uuid); | |
376 | int mirror_uuid_set(librados::IoCtx *ioctx, const std::string &uuid); | |
377 | void mirror_mode_get_start(librados::ObjectReadOperation *op); | |
378 | int mirror_mode_get_finish(bufferlist::const_iterator *it, | |
379 | cls::rbd::MirrorMode *mirror_mode); | |
380 | int mirror_mode_get(librados::IoCtx *ioctx, | |
381 | cls::rbd::MirrorMode *mirror_mode); | |
382 | int mirror_mode_set(librados::IoCtx *ioctx, | |
383 | cls::rbd::MirrorMode mirror_mode); | |
384 | int mirror_peer_list(librados::IoCtx *ioctx, | |
385 | std::vector<cls::rbd::MirrorPeer> *peers); | |
386 | int mirror_peer_add(librados::IoCtx *ioctx, const std::string &uuid, | |
387 | const std::string &cluster_name, | |
eafe8130 | 388 | const std::string &client_name); |
11fdf7f2 TL |
389 | int mirror_peer_remove(librados::IoCtx *ioctx, |
390 | const std::string &uuid); | |
391 | int mirror_peer_set_client(librados::IoCtx *ioctx, | |
392 | const std::string &uuid, | |
393 | const std::string &client_name); | |
394 | int mirror_peer_set_cluster(librados::IoCtx *ioctx, | |
395 | const std::string &uuid, | |
396 | const std::string &cluster_name); | |
397 | void mirror_image_list_start(librados::ObjectReadOperation *op, | |
7c673cae | 398 | const std::string &start, uint64_t max_return); |
11fdf7f2 TL |
399 | int mirror_image_list_finish(bufferlist::const_iterator *it, |
400 | std::map<string, string> *mirror_image_ids); | |
401 | int mirror_image_list(librados::IoCtx *ioctx, | |
402 | const std::string &start, uint64_t max_return, | |
403 | std::map<std::string, std::string> *mirror_image_ids); | |
404 | void mirror_image_get_image_id_start(librados::ObjectReadOperation *op, | |
405 | const std::string &global_image_id); | |
406 | int mirror_image_get_image_id_finish(bufferlist::const_iterator *it, | |
407 | std::string *image_id); | |
408 | int mirror_image_get_image_id(librados::IoCtx *ioctx, | |
409 | const std::string &global_image_id, | |
410 | std::string *image_id); | |
411 | int mirror_image_get(librados::IoCtx *ioctx, const std::string &image_id, | |
412 | cls::rbd::MirrorImage *mirror_image); | |
413 | void mirror_image_get_start(librados::ObjectReadOperation *op, | |
414 | const std::string &image_id); | |
415 | int mirror_image_get_finish(bufferlist::const_iterator *iter, | |
416 | cls::rbd::MirrorImage *mirror_image); | |
417 | void mirror_image_set(librados::ObjectWriteOperation *op, | |
418 | const std::string &image_id, | |
419 | const cls::rbd::MirrorImage &mirror_image); | |
420 | int mirror_image_set(librados::IoCtx *ioctx, const std::string &image_id, | |
421 | const cls::rbd::MirrorImage &mirror_image); | |
422 | void mirror_image_remove(librados::ObjectWriteOperation *op, | |
423 | const std::string &image_id); | |
424 | int mirror_image_remove(librados::IoCtx *ioctx, | |
425 | const std::string &image_id); | |
426 | int mirror_image_status_set(librados::IoCtx *ioctx, | |
427 | const std::string &global_image_id, | |
428 | const cls::rbd::MirrorImageStatus &status); | |
429 | void mirror_image_status_set(librados::ObjectWriteOperation *op, | |
430 | const std::string &global_image_id, | |
431 | const cls::rbd::MirrorImageStatus &status); | |
432 | int mirror_image_status_remove(librados::IoCtx *ioctx, | |
433 | const std::string &global_image_id); | |
434 | void mirror_image_status_remove(librados::ObjectWriteOperation *op, | |
435 | const std::string &global_image_id); | |
436 | int mirror_image_status_get(librados::IoCtx *ioctx, | |
437 | const std::string &global_image_id, | |
438 | cls::rbd::MirrorImageStatus *status); | |
439 | void mirror_image_status_get_start(librados::ObjectReadOperation *op, | |
440 | const std::string &global_image_id); | |
441 | int mirror_image_status_get_finish(bufferlist::const_iterator *iter, | |
442 | cls::rbd::MirrorImageStatus *status); | |
443 | int mirror_image_status_list(librados::IoCtx *ioctx, | |
444 | const std::string &start, uint64_t max_return, | |
445 | std::map<std::string, cls::rbd::MirrorImage> *images, | |
446 | std::map<std::string, cls::rbd::MirrorImageStatus> *statuses); | |
447 | void mirror_image_status_list_start(librados::ObjectReadOperation *op, | |
448 | const std::string &start, | |
449 | uint64_t max_return); | |
450 | int mirror_image_status_list_finish(bufferlist::const_iterator *iter, | |
451 | std::map<std::string, cls::rbd::MirrorImage> *images, | |
452 | std::map<std::string, cls::rbd::MirrorImageStatus> *statuses); | |
453 | int mirror_image_status_get_summary(librados::IoCtx *ioctx, | |
454 | std::map<cls::rbd::MirrorImageStatusState, int> *states); | |
455 | void mirror_image_status_get_summary_start(librados::ObjectReadOperation *op); | |
456 | int mirror_image_status_get_summary_finish(bufferlist::const_iterator *iter, | |
457 | std::map<cls::rbd::MirrorImageStatusState, int> *states); | |
458 | int mirror_image_status_remove_down(librados::IoCtx *ioctx); | |
459 | void mirror_image_status_remove_down(librados::ObjectWriteOperation *op); | |
460 | ||
461 | int mirror_image_instance_get(librados::IoCtx *ioctx, | |
462 | const std::string &global_image_id, | |
463 | entity_inst_t *instance); | |
464 | void mirror_image_instance_get_start(librados::ObjectReadOperation *op, | |
465 | const std::string &global_image_id); | |
466 | int mirror_image_instance_get_finish(bufferlist::const_iterator *iter, | |
467 | entity_inst_t *instance); | |
468 | int mirror_image_instance_list(librados::IoCtx *ioctx, | |
469 | const std::string &start, uint64_t max_return, | |
470 | std::map<std::string, entity_inst_t> *instances); | |
471 | void mirror_image_instance_list_start(librados::ObjectReadOperation *op, | |
472 | const std::string &start, | |
473 | uint64_t max_return); | |
474 | int mirror_image_instance_list_finish(bufferlist::const_iterator *iter, | |
475 | std::map<std::string, entity_inst_t> *instances); | |
476 | ||
477 | void mirror_instances_list_start(librados::ObjectReadOperation *op); | |
478 | int mirror_instances_list_finish(bufferlist::const_iterator *iter, | |
479 | std::vector<std::string> *instance_ids); | |
480 | int mirror_instances_list(librados::IoCtx *ioctx, | |
481 | std::vector<std::string> *instance_ids); | |
482 | void mirror_instances_add(librados::ObjectWriteOperation *op, | |
483 | const std::string &instance_id); | |
484 | int mirror_instances_add(librados::IoCtx *ioctx, | |
485 | const std::string &instance_id); | |
486 | void mirror_instances_remove(librados::ObjectWriteOperation *op, | |
7c673cae | 487 | const std::string &instance_id); |
11fdf7f2 TL |
488 | int mirror_instances_remove(librados::IoCtx *ioctx, |
489 | const std::string &instance_id); | |
490 | ||
491 | // image mapping related routines | |
492 | void mirror_image_map_list_start(librados::ObjectReadOperation *op, | |
493 | const std::string &start_after, | |
494 | uint64_t max_read); | |
495 | int mirror_image_map_list_finish(bufferlist::const_iterator *iter, | |
496 | std::map<std::string, cls::rbd::MirrorImageMap> *image_mapping); | |
497 | int mirror_image_map_list(librados::IoCtx *ioctx, | |
498 | const std::string &start_after, uint64_t max_read, | |
499 | std::map<std::string, cls::rbd::MirrorImageMap> *image_mapping); | |
500 | void mirror_image_map_update(librados::ObjectWriteOperation *op, | |
501 | const std::string &global_image_id, | |
502 | const cls::rbd::MirrorImageMap &image_map); | |
503 | void mirror_image_map_remove(librados::ObjectWriteOperation *op, | |
504 | const std::string &global_image_id); | |
505 | ||
506 | // Groups functions | |
507 | int group_dir_list(librados::IoCtx *ioctx, const std::string &oid, | |
508 | const std::string &start, uint64_t max_return, | |
509 | map<string, string> *groups); | |
510 | int group_dir_add(librados::IoCtx *ioctx, const std::string &oid, | |
511 | const std::string &name, const std::string &id); | |
512 | int group_dir_rename(librados::IoCtx *ioctx, const std::string &oid, | |
513 | const std::string &src, const std::string &dest, | |
514 | const std::string &id); | |
515 | int group_dir_remove(librados::IoCtx *ioctx, const std::string &oid, | |
516 | const std::string &name, const std::string &id); | |
517 | int group_image_remove(librados::IoCtx *ioctx, const std::string &oid, | |
518 | const cls::rbd::GroupImageSpec &spec); | |
519 | int group_image_list(librados::IoCtx *ioctx, const std::string &oid, | |
520 | const cls::rbd::GroupImageSpec &start, | |
521 | uint64_t max_return, | |
522 | std::vector<cls::rbd::GroupImageStatus> *images); | |
523 | int group_image_set(librados::IoCtx *ioctx, const std::string &oid, | |
524 | const cls::rbd::GroupImageStatus &st); | |
525 | int image_group_add(librados::IoCtx *ioctx, const std::string &oid, | |
526 | const cls::rbd::GroupSpec &group_spec); | |
527 | int image_group_remove(librados::IoCtx *ioctx, const std::string &oid, | |
528 | const cls::rbd::GroupSpec &group_spec); | |
529 | void image_group_get_start(librados::ObjectReadOperation *op); | |
530 | int image_group_get_finish(bufferlist::const_iterator *iter, | |
531 | cls::rbd::GroupSpec *group_spec); | |
532 | int image_group_get(librados::IoCtx *ioctx, const std::string &oid, | |
533 | cls::rbd::GroupSpec *group_spec); | |
534 | int group_snap_set(librados::IoCtx *ioctx, const std::string &oid, | |
535 | const cls::rbd::GroupSnapshot &snapshot); | |
536 | int group_snap_remove(librados::IoCtx *ioctx, const std::string &oid, | |
537 | const std::string &snap_id); | |
538 | int group_snap_get_by_id(librados::IoCtx *ioctx, const std::string &oid, | |
539 | const std::string &snap_id, | |
540 | cls::rbd::GroupSnapshot *snapshot); | |
541 | int group_snap_list(librados::IoCtx *ioctx, const std::string &oid, | |
542 | const cls::rbd::GroupSnapshot &start, | |
543 | uint64_t max_return, | |
544 | std::vector<cls::rbd::GroupSnapshot> *snapshots); | |
545 | ||
546 | // operations on rbd_trash object | |
547 | void trash_add(librados::ObjectWriteOperation *op, | |
548 | const std::string &id, | |
549 | const cls::rbd::TrashImageSpec &trash_spec); | |
550 | int trash_add(librados::IoCtx *ioctx, const std::string &id, | |
551 | const cls::rbd::TrashImageSpec &trash_spec); | |
552 | void trash_remove(librados::ObjectWriteOperation *op, | |
553 | const std::string &id); | |
554 | int trash_remove(librados::IoCtx *ioctx, const std::string &id); | |
555 | void trash_list_start(librados::ObjectReadOperation *op, | |
556 | const std::string &start, uint64_t max_return); | |
557 | int trash_list_finish(bufferlist::const_iterator *it, | |
558 | map<string, cls::rbd::TrashImageSpec> *entries); | |
559 | int trash_list(librados::IoCtx *ioctx, | |
560 | const std::string &start, uint64_t max_return, | |
561 | map<string, cls::rbd::TrashImageSpec> *entries); | |
562 | void trash_get_start(librados::ObjectReadOperation *op, | |
563 | const std::string &id); | |
564 | int trash_get_finish(bufferlist::const_iterator *it, | |
565 | cls::rbd::TrashImageSpec *trash_spec); | |
566 | int trash_get(librados::IoCtx *ioctx, const std::string &id, | |
567 | cls::rbd::TrashImageSpec *trash_spec); | |
568 | void trash_state_set(librados::ObjectWriteOperation *op, | |
569 | const std::string &id, | |
570 | const cls::rbd::TrashImageState &trash_state, | |
571 | const cls::rbd::TrashImageState &expect_state); | |
572 | int trash_state_set(librados::IoCtx *ioctx, const std::string &id, | |
573 | const cls::rbd::TrashImageState &trash_state, | |
574 | const cls::rbd::TrashImageState &expect_state); | |
575 | ||
576 | // operations on rbd_namespace object | |
577 | void namespace_add(librados::ObjectWriteOperation *op, | |
578 | const std::string &name); | |
579 | int namespace_add(librados::IoCtx *ioctx, const std::string &name); | |
580 | void namespace_remove(librados::ObjectWriteOperation *op, | |
581 | const std::string &name); | |
582 | int namespace_remove(librados::IoCtx *ioctx, const std::string &name); | |
583 | void namespace_list_start(librados::ObjectReadOperation *op, | |
c07f9fc5 | 584 | const std::string &start, uint64_t max_return); |
11fdf7f2 TL |
585 | int namespace_list_finish(bufferlist::const_iterator *it, |
586 | std::list<std::string> *entries); | |
587 | int namespace_list(librados::IoCtx *ioctx, | |
c07f9fc5 | 588 | const std::string &start, uint64_t max_return, |
11fdf7f2 TL |
589 | std::list<std::string> *entries); |
590 | ||
591 | // operations on data objects | |
592 | int assert_snapc_seq(librados::IoCtx *ioctx, const std::string &oid, | |
593 | uint64_t snapc_seq, | |
594 | cls::rbd::AssertSnapcSeqState state); | |
595 | void assert_snapc_seq(librados::ObjectWriteOperation *op, | |
596 | uint64_t snapc_seq, | |
597 | cls::rbd::AssertSnapcSeqState state); | |
598 | ||
599 | int copyup(librados::IoCtx *ioctx, const std::string &oid, | |
600 | bufferlist data); | |
601 | ||
602 | void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size, | |
603 | bool remove_empty); | |
604 | int sparsify(librados::IoCtx *ioctx, const std::string &oid, size_t sparse_size, | |
605 | bool remove_empty); | |
606 | ||
607 | } // namespace cls_client | |
7c673cae | 608 | } // namespace librbd |
11fdf7f2 | 609 | |
7c673cae | 610 | #endif // CEPH_LIBRBD_CLS_RBD_CLIENT_H |