]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef __LIBRADOS_HPP |
2 | #define __LIBRADOS_HPP | |
3 | ||
7c673cae FG |
4 | #include <string> |
5 | #include <list> | |
6 | #include <map> | |
11fdf7f2 | 7 | #include <memory> |
7c673cae FG |
8 | #include <set> |
9 | #include <vector> | |
10 | #include <utility> | |
7c673cae FG |
11 | #include "buffer.h" |
12 | ||
13 | #include "librados.h" | |
11fdf7f2 | 14 | #include "librados_fwd.hpp" |
7c673cae FG |
15 | #include "rados_types.hpp" |
16 | ||
17 | namespace libradosstriper | |
18 | { | |
19 | class RadosStriper; | |
20 | } | |
21 | ||
f67539c2 TL |
22 | namespace neorados { class RADOS; } |
23 | ||
11fdf7f2 | 24 | namespace librados { |
7c673cae | 25 | |
11fdf7f2 TL |
26 | using ceph::bufferlist; |
27 | ||
28 | struct AioCompletionImpl; | |
29 | struct IoCtxImpl; | |
30 | struct ListObjectImpl; | |
31 | class NObjectIteratorImpl; | |
32 | struct ObjListCtx; | |
33 | class ObjectOperationImpl; | |
34 | struct PlacementGroupImpl; | |
35 | struct PoolAsyncCompletionImpl; | |
7c673cae | 36 | |
11fdf7f2 TL |
37 | typedef struct rados_cluster_stat_t cluster_stat_t; |
38 | typedef struct rados_pool_stat_t pool_stat_t; | |
7c673cae | 39 | |
11fdf7f2 TL |
40 | typedef void *list_ctx_t; |
41 | typedef uint64_t auid_t; | |
42 | typedef void *config_t; | |
7c673cae | 43 | |
11fdf7f2 TL |
44 | typedef struct { |
45 | std::string client; | |
46 | std::string cookie; | |
47 | std::string address; | |
48 | } locker_t; | |
7c673cae | 49 | |
11fdf7f2 | 50 | typedef std::map<std::string, pool_stat_t> stats_map; |
7c673cae | 51 | |
11fdf7f2 TL |
52 | typedef void *completion_t; |
53 | typedef void (*callback_t)(completion_t cb, void *arg); | |
54 | ||
55 | inline namespace v14_2_0 { | |
56 | ||
57 | class IoCtx; | |
58 | class RadosClient; | |
7c673cae FG |
59 | |
60 | class CEPH_RADOS_API ListObject | |
61 | { | |
62 | public: | |
63 | const std::string& get_nspace() const; | |
64 | const std::string& get_oid() const; | |
65 | const std::string& get_locator() const; | |
66 | ||
67 | ListObject(); | |
68 | ~ListObject(); | |
69 | ListObject( const ListObject&); | |
70 | ListObject& operator=(const ListObject& rhs); | |
71 | private: | |
72 | ListObject(ListObjectImpl *impl); | |
73 | ||
11fdf7f2 | 74 | friend class librados::NObjectIteratorImpl; |
7c673cae FG |
75 | friend std::ostream& operator<<(std::ostream& out, const ListObject& lop); |
76 | ||
77 | ListObjectImpl *impl; | |
78 | }; | |
79 | CEPH_RADOS_API std::ostream& operator<<(std::ostream& out, const librados::ListObject& lop); | |
80 | ||
81 | class CEPH_RADOS_API NObjectIterator; | |
82 | ||
83 | class CEPH_RADOS_API ObjectCursor | |
84 | { | |
85 | public: | |
86 | ObjectCursor(); | |
87 | ObjectCursor(const ObjectCursor &rhs); | |
88 | explicit ObjectCursor(rados_object_list_cursor c); | |
89 | ~ObjectCursor(); | |
90 | ObjectCursor& operator=(const ObjectCursor& rhs); | |
91 | bool operator<(const ObjectCursor &rhs) const; | |
92 | bool operator==(const ObjectCursor &rhs) const; | |
93 | void set(rados_object_list_cursor c); | |
94 | ||
95 | friend class IoCtx; | |
11fdf7f2 | 96 | friend class librados::NObjectIteratorImpl; |
7c673cae FG |
97 | friend std::ostream& operator<<(std::ostream& os, const librados::ObjectCursor& oc); |
98 | ||
99 | std::string to_str() const; | |
100 | bool from_str(const std::string& s); | |
101 | ||
102 | protected: | |
103 | rados_object_list_cursor c_cursor; | |
104 | }; | |
105 | CEPH_RADOS_API std::ostream& operator<<(std::ostream& os, const librados::ObjectCursor& oc); | |
106 | ||
107 | class CEPH_RADOS_API NObjectIterator : public std::iterator <std::forward_iterator_tag, ListObject> { | |
108 | public: | |
109 | static const NObjectIterator __EndObjectIterator; | |
110 | NObjectIterator(): impl(NULL) {} | |
111 | ~NObjectIterator(); | |
112 | NObjectIterator(const NObjectIterator &rhs); | |
113 | NObjectIterator& operator=(const NObjectIterator& rhs); | |
114 | ||
115 | bool operator==(const NObjectIterator& rhs) const; | |
116 | bool operator!=(const NObjectIterator& rhs) const; | |
117 | const ListObject& operator*() const; | |
118 | const ListObject* operator->() const; | |
f64942e4 AA |
119 | NObjectIterator &operator++(); //< Preincrement; errors are thrown as exceptions |
120 | NObjectIterator operator++(int); //< Postincrement; errors are thrown as exceptions | |
7c673cae | 121 | friend class IoCtx; |
11fdf7f2 | 122 | friend class librados::NObjectIteratorImpl; |
7c673cae FG |
123 | |
124 | /// get current hash position of the iterator, rounded to the current pg | |
125 | uint32_t get_pg_hash_position() const; | |
126 | ||
f64942e4 AA |
127 | /// move the iterator to a given hash position. this may (will!) be rounded |
128 | /// to the nearest pg. errors are thrown as exceptions | |
7c673cae FG |
129 | uint32_t seek(uint32_t pos); |
130 | ||
f64942e4 | 131 | /// move the iterator to a given cursor position. errors are thrown as exceptions |
7c673cae FG |
132 | uint32_t seek(const ObjectCursor& cursor); |
133 | ||
134 | /// get current cursor position | |
135 | ObjectCursor get_cursor(); | |
136 | ||
137 | /** | |
138 | * Configure PGLS filter to be applied OSD-side (requires caller | |
139 | * to know/understand the format expected by the OSD) | |
140 | */ | |
141 | void set_filter(const bufferlist &bl); | |
142 | ||
143 | private: | |
144 | NObjectIterator(ObjListCtx *ctx_); | |
145 | void get_next(); | |
146 | NObjectIteratorImpl *impl; | |
147 | }; | |
148 | ||
149 | class CEPH_RADOS_API ObjectItem | |
150 | { | |
151 | public: | |
152 | std::string oid; | |
153 | std::string nspace; | |
154 | std::string locator; | |
155 | }; | |
156 | ||
157 | /// DEPRECATED; do not use | |
158 | class CEPH_RADOS_API WatchCtx { | |
159 | public: | |
160 | virtual ~WatchCtx(); | |
161 | virtual void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) = 0; | |
162 | }; | |
163 | ||
164 | class CEPH_RADOS_API WatchCtx2 { | |
165 | public: | |
166 | virtual ~WatchCtx2(); | |
167 | /** | |
168 | * Callback activated when we receive a notify event. | |
169 | * | |
170 | * @param notify_id unique id for this notify event | |
171 | * @param cookie the watcher we are notifying | |
172 | * @param notifier_id the unique client id of the notifier | |
173 | * @param bl opaque notify payload (from the notifier) | |
174 | */ | |
175 | virtual void handle_notify(uint64_t notify_id, | |
176 | uint64_t cookie, | |
177 | uint64_t notifier_id, | |
178 | bufferlist& bl) = 0; | |
179 | ||
180 | /** | |
181 | * Callback activated when we encounter an error with the watch. | |
182 | * | |
183 | * Errors we may see: | |
184 | * -ENOTCONN : our watch was disconnected | |
185 | * -ETIMEDOUT : our watch is still valid, but we may have missed | |
186 | * a notify event. | |
187 | * | |
188 | * @param cookie the watcher with the problem | |
189 | * @param err error | |
190 | */ | |
191 | virtual void handle_error(uint64_t cookie, int err) = 0; | |
192 | }; | |
193 | ||
194 | struct CEPH_RADOS_API AioCompletion { | |
195 | AioCompletion(AioCompletionImpl *pc_) : pc(pc_) {} | |
9f95a23c | 196 | ~AioCompletion(); |
7c673cae | 197 | int set_complete_callback(void *cb_arg, callback_t cb); |
9f95a23c TL |
198 | int set_safe_callback(void *cb_arg, callback_t cb) |
199 | __attribute__ ((deprecated)); | |
7c673cae | 200 | int wait_for_complete(); |
9f95a23c | 201 | int wait_for_safe() __attribute__ ((deprecated)); |
7c673cae | 202 | int wait_for_complete_and_cb(); |
9f95a23c | 203 | int wait_for_safe_and_cb() __attribute__ ((deprecated)); |
7c673cae | 204 | bool is_complete(); |
9f95a23c | 205 | bool is_safe() __attribute__ ((deprecated)); |
7c673cae | 206 | bool is_complete_and_cb(); |
9f95a23c | 207 | bool is_safe_and_cb() __attribute__ ((deprecated)); |
7c673cae FG |
208 | int get_return_value(); |
209 | int get_version() __attribute__ ((deprecated)); | |
210 | uint64_t get_version64(); | |
211 | void release(); | |
212 | AioCompletionImpl *pc; | |
213 | }; | |
214 | ||
215 | struct CEPH_RADOS_API PoolAsyncCompletion { | |
216 | PoolAsyncCompletion(PoolAsyncCompletionImpl *pc_) : pc(pc_) {} | |
9f95a23c | 217 | ~PoolAsyncCompletion(); |
7c673cae FG |
218 | int set_callback(void *cb_arg, callback_t cb); |
219 | int wait(); | |
220 | bool is_complete(); | |
221 | int get_return_value(); | |
222 | void release(); | |
223 | PoolAsyncCompletionImpl *pc; | |
224 | }; | |
225 | ||
226 | /** | |
227 | * These are per-op flags which may be different among | |
228 | * ops added to an ObjectOperation. | |
229 | */ | |
230 | enum ObjectOperationFlags { | |
231 | OP_EXCL = LIBRADOS_OP_FLAG_EXCL, | |
232 | OP_FAILOK = LIBRADOS_OP_FLAG_FAILOK, | |
233 | OP_FADVISE_RANDOM = LIBRADOS_OP_FLAG_FADVISE_RANDOM, | |
234 | OP_FADVISE_SEQUENTIAL = LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL, | |
235 | OP_FADVISE_WILLNEED = LIBRADOS_OP_FLAG_FADVISE_WILLNEED, | |
236 | OP_FADVISE_DONTNEED = LIBRADOS_OP_FLAG_FADVISE_DONTNEED, | |
237 | OP_FADVISE_NOCACHE = LIBRADOS_OP_FLAG_FADVISE_NOCACHE, | |
238 | }; | |
239 | ||
240 | class CEPH_RADOS_API ObjectOperationCompletion { | |
241 | public: | |
242 | virtual ~ObjectOperationCompletion() {} | |
243 | virtual void handle_completion(int r, bufferlist& outbl) = 0; | |
244 | }; | |
245 | ||
246 | /** | |
247 | * These flags apply to the ObjectOperation as a whole. | |
248 | * | |
249 | * BALANCE_READS and LOCALIZE_READS should only be used | |
250 | * when reading from data you're certain won't change, | |
251 | * like a snapshot, or where eventual consistency is ok. | |
252 | * | |
253 | * ORDER_READS_WRITES will order reads the same way writes are | |
254 | * ordered (e.g., waiting for degraded objects). In particular, it | |
255 | * will make a write followed by a read sequence be preserved. | |
256 | * | |
257 | * IGNORE_CACHE will skip the caching logic on the OSD that normally | |
258 | * handles promotion of objects between tiers. This allows an operation | |
259 | * to operate (or read) the cached (or uncached) object, even if it is | |
260 | * not coherent. | |
261 | * | |
262 | * IGNORE_OVERLAY will ignore the pool overlay tiering metadata and | |
263 | * process the op directly on the destination pool. This is useful | |
264 | * for CACHE_FLUSH and CACHE_EVICT operations. | |
265 | */ | |
266 | enum ObjectOperationGlobalFlags { | |
267 | OPERATION_NOFLAG = LIBRADOS_OPERATION_NOFLAG, | |
268 | OPERATION_BALANCE_READS = LIBRADOS_OPERATION_BALANCE_READS, | |
269 | OPERATION_LOCALIZE_READS = LIBRADOS_OPERATION_LOCALIZE_READS, | |
270 | OPERATION_ORDER_READS_WRITES = LIBRADOS_OPERATION_ORDER_READS_WRITES, | |
271 | OPERATION_IGNORE_CACHE = LIBRADOS_OPERATION_IGNORE_CACHE, | |
272 | OPERATION_SKIPRWLOCKS = LIBRADOS_OPERATION_SKIPRWLOCKS, | |
273 | OPERATION_IGNORE_OVERLAY = LIBRADOS_OPERATION_IGNORE_OVERLAY, | |
274 | // send requests to cluster despite the cluster or pool being | |
275 | // marked full; ops will either succeed (e.g., delete) or return | |
276 | // EDQUOT or ENOSPC | |
277 | OPERATION_FULL_TRY = LIBRADOS_OPERATION_FULL_TRY, | |
9f95a23c | 278 | // mainly for delete |
7c673cae | 279 | OPERATION_FULL_FORCE = LIBRADOS_OPERATION_FULL_FORCE, |
31f18b77 | 280 | OPERATION_IGNORE_REDIRECT = LIBRADOS_OPERATION_IGNORE_REDIRECT, |
11fdf7f2 | 281 | OPERATION_ORDERSNAP = LIBRADOS_OPERATION_ORDERSNAP, |
9f95a23c TL |
282 | // enable/allow return value and per-op return code/buffers |
283 | OPERATION_RETURNVEC = LIBRADOS_OPERATION_RETURNVEC, | |
7c673cae FG |
284 | }; |
285 | ||
286 | /* | |
287 | * Alloc hint flags for the alloc_hint operation. | |
288 | */ | |
289 | enum AllocHintFlags { | |
290 | ALLOC_HINT_FLAG_SEQUENTIAL_WRITE = 1, | |
291 | ALLOC_HINT_FLAG_RANDOM_WRITE = 2, | |
292 | ALLOC_HINT_FLAG_SEQUENTIAL_READ = 4, | |
293 | ALLOC_HINT_FLAG_RANDOM_READ = 8, | |
294 | ALLOC_HINT_FLAG_APPEND_ONLY = 16, | |
295 | ALLOC_HINT_FLAG_IMMUTABLE = 32, | |
296 | ALLOC_HINT_FLAG_SHORTLIVED = 64, | |
297 | ALLOC_HINT_FLAG_LONGLIVED = 128, | |
298 | ALLOC_HINT_FLAG_COMPRESSIBLE = 256, | |
299 | ALLOC_HINT_FLAG_INCOMPRESSIBLE = 512, | |
300 | }; | |
301 | ||
302 | /* | |
303 | * ObjectOperation : compound object operation | |
304 | * Batch multiple object operations into a single request, to be applied | |
305 | * atomically. | |
306 | */ | |
307 | class CEPH_RADOS_API ObjectOperation | |
308 | { | |
309 | public: | |
310 | ObjectOperation(); | |
311 | virtual ~ObjectOperation(); | |
312 | ||
9f95a23c TL |
313 | ObjectOperation(const ObjectOperation&) = delete; |
314 | ObjectOperation& operator=(const ObjectOperation&) = delete; | |
315 | ||
316 | /** | |
317 | * Move constructor. | |
318 | * \warning A moved from ObjectOperation is invalid and may not be used for | |
319 | * any purpose. This is a hard contract violation and will | |
320 | * kill your program. | |
321 | */ | |
322 | ObjectOperation(ObjectOperation&&); | |
323 | ObjectOperation& operator =(ObjectOperation&&); | |
324 | ||
7c673cae FG |
325 | size_t size(); |
326 | void set_op_flags(ObjectOperationFlags flags) __attribute__((deprecated)); | |
327 | //flag mean ObjectOperationFlags | |
328 | void set_op_flags2(int flags); | |
329 | ||
11fdf7f2 | 330 | void cmpext(uint64_t off, const bufferlist& cmp_bl, int *prval); |
7c673cae FG |
331 | void cmpxattr(const char *name, uint8_t op, const bufferlist& val); |
332 | void cmpxattr(const char *name, uint8_t op, uint64_t v); | |
333 | void exec(const char *cls, const char *method, bufferlist& inbl); | |
334 | void exec(const char *cls, const char *method, bufferlist& inbl, bufferlist *obl, int *prval); | |
335 | void exec(const char *cls, const char *method, bufferlist& inbl, ObjectOperationCompletion *completion); | |
336 | /** | |
337 | * Guard operation with a check that object version == ver | |
338 | * | |
339 | * @param ver [in] version to check | |
340 | */ | |
341 | void assert_version(uint64_t ver); | |
342 | ||
343 | /** | |
11fdf7f2 | 344 | * Guard operation with a check that the object already exists |
7c673cae FG |
345 | */ |
346 | void assert_exists(); | |
347 | ||
348 | /** | |
349 | * get key/value pairs for specified keys | |
350 | * | |
351 | * @param assertions [in] comparison assertions | |
352 | * @param prval [out] place error code in prval upon completion | |
353 | * | |
354 | * assertions has the form of mappings from keys to (comparison rval, assertion) | |
355 | * The assertion field may be CEPH_OSD_CMPXATTR_OP_[GT|LT|EQ]. | |
356 | * | |
357 | * That is, to assert that the value at key 'foo' is greater than 'bar': | |
358 | * | |
359 | * ObjectReadOperation op; | |
360 | * int r; | |
361 | * map<string, pair<bufferlist, int> > assertions; | |
362 | * bufferlist bar(string('bar')); | |
363 | * assertions['foo'] = make_pair(bar, CEPH_OSD_CMP_XATTR_OP_GT); | |
364 | * op.omap_cmp(assertions, &r); | |
365 | */ | |
366 | void omap_cmp( | |
367 | const std::map<std::string, std::pair<bufferlist, int> > &assertions, | |
368 | int *prval); | |
369 | ||
370 | protected: | |
9f95a23c | 371 | ObjectOperationImpl* impl; |
7c673cae FG |
372 | friend class IoCtx; |
373 | friend class Rados; | |
374 | }; | |
375 | ||
376 | /* | |
377 | * ObjectWriteOperation : compound object write operation | |
378 | * Batch multiple object operations into a single request, to be applied | |
379 | * atomically. | |
380 | */ | |
381 | class CEPH_RADOS_API ObjectWriteOperation : public ObjectOperation | |
382 | { | |
383 | protected: | |
384 | time_t *unused; | |
385 | public: | |
386 | ObjectWriteOperation() : unused(NULL) {} | |
387 | ~ObjectWriteOperation() override {} | |
388 | ||
9f95a23c TL |
389 | ObjectWriteOperation(ObjectWriteOperation&&) = default; |
390 | ObjectWriteOperation& operator =(ObjectWriteOperation&&) = default; | |
391 | ||
7c673cae FG |
392 | void mtime(time_t *pt); |
393 | void mtime2(struct timespec *pts); | |
394 | ||
395 | void create(bool exclusive); | |
396 | void create(bool exclusive, | |
397 | const std::string& category); ///< NOTE: category is unused | |
398 | ||
399 | void write(uint64_t off, const bufferlist& bl); | |
400 | void write_full(const bufferlist& bl); | |
401 | void writesame(uint64_t off, uint64_t write_len, | |
402 | const bufferlist& bl); | |
403 | void append(const bufferlist& bl); | |
404 | void remove(); | |
405 | void truncate(uint64_t off); | |
406 | void zero(uint64_t off, uint64_t len); | |
407 | void rmxattr(const char *name); | |
408 | void setxattr(const char *name, const bufferlist& bl); | |
11fdf7f2 | 409 | void setxattr(const char *name, const bufferlist&& bl); |
7c673cae FG |
410 | void tmap_update(const bufferlist& cmdbl); |
411 | void tmap_put(const bufferlist& bl); | |
412 | void selfmanaged_snap_rollback(uint64_t snapid); | |
413 | ||
414 | /** | |
415 | * Rollback an object to the specified snapshot id | |
416 | * | |
417 | * Used with pool snapshots | |
418 | * | |
419 | * @param snapid [in] snopshot id specified | |
420 | */ | |
421 | void snap_rollback(uint64_t snapid); | |
422 | ||
423 | /** | |
424 | * set keys and values according to map | |
425 | * | |
426 | * @param map [in] keys and values to set | |
427 | */ | |
428 | void omap_set(const std::map<std::string, bufferlist> &map); | |
429 | ||
430 | /** | |
431 | * set header | |
432 | * | |
433 | * @param bl [in] header to set | |
434 | */ | |
435 | void omap_set_header(const bufferlist &bl); | |
436 | ||
437 | /** | |
438 | * Clears omap contents | |
439 | */ | |
440 | void omap_clear(); | |
441 | ||
442 | /** | |
443 | * Clears keys in to_rm | |
444 | * | |
445 | * @param to_rm [in] keys to remove | |
446 | */ | |
447 | void omap_rm_keys(const std::set<std::string> &to_rm); | |
448 | ||
449 | /** | |
450 | * Copy an object | |
451 | * | |
452 | * Copies an object from another location. The operation is atomic in that | |
453 | * the copy either succeeds in its entirety or fails (e.g., because the | |
454 | * source object was modified while the copy was in progress). | |
455 | * | |
456 | * @param src source object name | |
457 | * @param src_ioctx ioctx for the source object | |
458 | * @param src_version current version of the source object | |
459 | * @param src_fadvise_flags the fadvise flags for source object | |
460 | */ | |
461 | void copy_from(const std::string& src, const IoCtx& src_ioctx, | |
11fdf7f2 | 462 | uint64_t src_version, uint32_t src_fadvise_flags); |
7c673cae | 463 | |
9f95a23c TL |
464 | /** |
465 | * Copy an object | |
466 | * | |
467 | * Copies an object from another location. The operation is atomic in that | |
468 | * the copy either succeeds in its entirety or fails (e.g., because the | |
469 | * source object was modified while the copy was in progress). Instead of | |
470 | * copying truncate_seq and truncate_size from the source object it receives | |
471 | * these values as parameters. | |
472 | * | |
473 | * @param src source object name | |
474 | * @param src_ioctx ioctx for the source object | |
475 | * @param src_version current version of the source object | |
476 | * @param truncate_seq truncate sequence for the destination object | |
477 | * @param truncate_size truncate size for the destination object | |
478 | * @param src_fadvise_flags the fadvise flags for source object | |
479 | */ | |
480 | void copy_from2(const std::string& src, const IoCtx& src_ioctx, | |
481 | uint64_t src_version, uint32_t truncate_seq, | |
482 | uint64_t truncate_size, uint32_t src_fadvise_flags); | |
483 | ||
7c673cae FG |
484 | /** |
485 | * undirty an object | |
486 | * | |
487 | * Clear an objects dirty flag | |
488 | */ | |
489 | void undirty(); | |
490 | ||
491 | /** | |
492 | * Set allocation hint for an object | |
493 | * | |
494 | * @param expected_object_size expected size of the object, in bytes | |
495 | * @param expected_write_size expected size of writes to the object, in bytes | |
496 | * @param flags flags () | |
497 | */ | |
498 | void set_alloc_hint(uint64_t expected_object_size, | |
499 | uint64_t expected_write_size); | |
500 | void set_alloc_hint2(uint64_t expected_object_size, | |
501 | uint64_t expected_write_size, | |
502 | uint32_t flags); | |
503 | ||
504 | /** | |
505 | * Pin/unpin an object in cache tier | |
506 | * | |
507 | * @returns 0 on success, negative error code on failure | |
508 | */ | |
509 | void cache_pin(); | |
510 | void cache_unpin(); | |
511 | ||
31f18b77 FG |
512 | /** |
513 | * Extensible tier | |
514 | * | |
515 | * Set redirect target | |
516 | */ | |
517 | void set_redirect(const std::string& tgt_obj, const IoCtx& tgt_ioctx, | |
11fdf7f2 | 518 | uint64_t tgt_version, int flag = 0); |
11fdf7f2 TL |
519 | void tier_promote(); |
520 | void unset_manifest(); | |
31f18b77 | 521 | |
7c673cae FG |
522 | friend class IoCtx; |
523 | }; | |
524 | ||
525 | /* | |
526 | * ObjectReadOperation : compound object operation that return value | |
527 | * Batch multiple object operations into a single request, to be applied | |
528 | * atomically. | |
529 | */ | |
530 | class CEPH_RADOS_API ObjectReadOperation : public ObjectOperation | |
531 | { | |
532 | public: | |
533 | ObjectReadOperation() {} | |
534 | ~ObjectReadOperation() override {} | |
535 | ||
9f95a23c TL |
536 | ObjectReadOperation(ObjectReadOperation&&) = default; |
537 | ObjectReadOperation& operator =(ObjectReadOperation&&) = default; | |
538 | ||
7c673cae FG |
539 | void stat(uint64_t *psize, time_t *pmtime, int *prval); |
540 | void stat2(uint64_t *psize, struct timespec *pts, int *prval); | |
541 | void getxattr(const char *name, bufferlist *pbl, int *prval); | |
542 | void getxattrs(std::map<std::string, bufferlist> *pattrs, int *prval); | |
543 | void read(size_t off, uint64_t len, bufferlist *pbl, int *prval); | |
544 | void checksum(rados_checksum_type_t type, const bufferlist &init_value_bl, | |
545 | uint64_t off, size_t len, size_t chunk_size, bufferlist *pbl, | |
546 | int *prval); | |
547 | ||
548 | /** | |
549 | * see aio_sparse_read() | |
550 | */ | |
551 | void sparse_read(uint64_t off, uint64_t len, std::map<uint64_t,uint64_t> *m, | |
552 | bufferlist *data_bl, int *prval); | |
7c673cae FG |
553 | |
554 | /** | |
555 | * omap_get_vals: keys and values from the object omap | |
556 | * | |
557 | * Get up to max_return keys and values beginning after start_after | |
558 | * | |
559 | * @param start_after [in] list no keys smaller than start_after | |
560 | * @param max_return [in] list no more than max_return key/value pairs | |
561 | * @param out_vals [out] place returned values in out_vals on completion | |
562 | * @param prval [out] place error code in prval upon completion | |
563 | */ | |
564 | void omap_get_vals( | |
565 | const std::string &start_after, | |
566 | uint64_t max_return, | |
567 | std::map<std::string, bufferlist> *out_vals, | |
568 | int *prval) __attribute__ ((deprecated)); // use v2 | |
569 | ||
570 | /** | |
571 | * omap_get_vals: keys and values from the object omap | |
572 | * | |
573 | * Get up to max_return keys and values beginning after start_after | |
574 | * | |
575 | * @param start_after [in] list no keys smaller than start_after | |
576 | * @param max_return [in] list no more than max_return key/value pairs | |
577 | * @param out_vals [out] place returned values in out_vals on completion | |
578 | * @param prval [out] place error code in prval upon completion | |
579 | */ | |
580 | void omap_get_vals2( | |
581 | const std::string &start_after, | |
582 | uint64_t max_return, | |
583 | std::map<std::string, bufferlist> *out_vals, | |
584 | bool *pmore, | |
585 | int *prval); | |
586 | ||
587 | /** | |
588 | * omap_get_vals: keys and values from the object omap | |
589 | * | |
590 | * Get up to max_return keys and values beginning after start_after | |
591 | * | |
592 | * @param start_after [in] list keys starting after start_after | |
593 | * @param filter_prefix [in] list only keys beginning with filter_prefix | |
594 | * @param max_return [in] list no more than max_return key/value pairs | |
595 | * @param out_vals [out] place returned values in out_vals on completion | |
596 | * @param prval [out] place error code in prval upon completion | |
597 | */ | |
598 | void omap_get_vals( | |
599 | const std::string &start_after, | |
600 | const std::string &filter_prefix, | |
601 | uint64_t max_return, | |
602 | std::map<std::string, bufferlist> *out_vals, | |
603 | int *prval) __attribute__ ((deprecated)); // use v2 | |
604 | ||
605 | /** | |
606 | * omap_get_vals2: keys and values from the object omap | |
607 | * | |
608 | * Get up to max_return keys and values beginning after start_after | |
609 | * | |
610 | * @param start_after [in] list keys starting after start_after | |
611 | * @param filter_prefix [in] list only keys beginning with filter_prefix | |
612 | * @param max_return [in] list no more than max_return key/value pairs | |
613 | * @param out_vals [out] place returned values in out_vals on completion | |
614 | * @param pmore [out] pointer to bool indicating whether there are more keys | |
615 | * @param prval [out] place error code in prval upon completion | |
616 | */ | |
617 | void omap_get_vals2( | |
618 | const std::string &start_after, | |
619 | const std::string &filter_prefix, | |
620 | uint64_t max_return, | |
621 | std::map<std::string, bufferlist> *out_vals, | |
622 | bool *pmore, | |
623 | int *prval); | |
624 | ||
625 | ||
626 | /** | |
627 | * omap_get_keys: keys from the object omap | |
628 | * | |
629 | * Get up to max_return keys beginning after start_after | |
630 | * | |
631 | * @param start_after [in] list keys starting after start_after | |
632 | * @param max_return [in] list no more than max_return keys | |
633 | * @param out_keys [out] place returned values in out_keys on completion | |
634 | * @param prval [out] place error code in prval upon completion | |
635 | */ | |
636 | void omap_get_keys(const std::string &start_after, | |
637 | uint64_t max_return, | |
638 | std::set<std::string> *out_keys, | |
639 | int *prval) __attribute__ ((deprecated)); // use v2 | |
640 | ||
641 | /** | |
642 | * omap_get_keys2: keys from the object omap | |
643 | * | |
644 | * Get up to max_return keys beginning after start_after | |
645 | * | |
646 | * @param start_after [in] list keys starting after start_after | |
647 | * @param max_return [in] list no more than max_return keys | |
648 | * @param out_keys [out] place returned values in out_keys on completion | |
649 | * @param pmore [out] pointer to bool indicating whether there are more keys | |
650 | * @param prval [out] place error code in prval upon completion | |
651 | */ | |
652 | void omap_get_keys2(const std::string &start_after, | |
653 | uint64_t max_return, | |
654 | std::set<std::string> *out_keys, | |
655 | bool *pmore, | |
656 | int *prval); | |
657 | ||
658 | /** | |
659 | * omap_get_header: get header from object omap | |
660 | * | |
661 | * @param header [out] place header here upon completion | |
662 | * @param prval [out] place error code in prval upon completion | |
663 | */ | |
664 | void omap_get_header(bufferlist *header, int *prval); | |
665 | ||
666 | /** | |
667 | * get key/value pairs for specified keys | |
668 | * | |
669 | * @param keys [in] keys to get | |
670 | * @param map [out] place key/value pairs found here on completion | |
671 | * @param prval [out] place error code in prval upon completion | |
672 | */ | |
673 | void omap_get_vals_by_keys(const std::set<std::string> &keys, | |
674 | std::map<std::string, bufferlist> *map, | |
675 | int *prval); | |
676 | ||
677 | /** | |
678 | * list_watchers: Get list watchers of object | |
679 | * | |
680 | * @param out_watchers [out] place returned values in out_watchers on completion | |
681 | * @param prval [out] place error code in prval upon completion | |
682 | */ | |
683 | void list_watchers(std::list<obj_watch_t> *out_watchers, int *prval); | |
684 | ||
685 | /** | |
686 | * list snapshot clones associated with a logical object | |
687 | * | |
688 | * This will include a record for each version of the object, | |
689 | * include the "HEAD" (which will have a cloneid of SNAP_HEAD). | |
690 | * Each clone includes a vector of snap ids for which it is | |
691 | * defined to exist. | |
692 | * | |
693 | * NOTE: this operation must be submitted from an IoCtx with a | |
694 | * read snapid of SNAP_DIR for reliable results. | |
695 | * | |
696 | * @param out_snaps [out] pointer to resulting snap_set_t | |
697 | * @param prval [out] place error code in prval upon completion | |
698 | */ | |
699 | void list_snaps(snap_set_t *out_snaps, int *prval); | |
700 | ||
701 | /** | |
702 | * query dirty state of an object | |
703 | * | |
704 | * @param isdirty [out] pointer to resulting bool | |
705 | * @param prval [out] place error code in prval upon completion | |
706 | */ | |
707 | void is_dirty(bool *isdirty, int *prval); | |
708 | ||
709 | /** | |
710 | * flush a cache tier object to backing tier; will block racing | |
711 | * updates. | |
712 | * | |
713 | * This should be used in concert with OPERATION_IGNORE_CACHE to avoid | |
714 | * triggering a promotion. | |
715 | */ | |
716 | void cache_flush(); | |
717 | ||
718 | /** | |
719 | * Flush a cache tier object to backing tier; will EAGAIN if we race | |
720 | * with an update. Must be used with the SKIPRWLOCKS flag. | |
721 | * | |
722 | * This should be used in concert with OPERATION_IGNORE_CACHE to avoid | |
723 | * triggering a promotion. | |
724 | */ | |
725 | void cache_try_flush(); | |
726 | ||
727 | /** | |
728 | * evict a clean cache tier object | |
729 | * | |
730 | * This should be used in concert with OPERATION_IGNORE_CACHE to avoid | |
731 | * triggering a promote on the OSD (that is then evicted). | |
732 | */ | |
733 | void cache_evict(); | |
f67539c2 TL |
734 | |
735 | /** | |
736 | * Extensible tier | |
737 | * | |
738 | * set_chunk: make a chunk pointing a part of the source object at the target | |
739 | * object | |
740 | * | |
741 | * @param src_offset [in] source offset to indicate the start position of | |
742 | * a chunk in the source object | |
743 | * @param src_length [in] source length to set the length of the chunk | |
744 | * @param tgt_oid [in] target object's id to set a chunk | |
745 | * @param tgt_offset [in] the start position of the target object | |
746 | * @param flag [in] flag for the source object | |
747 | * | |
748 | */ | |
749 | void set_chunk(uint64_t src_offset, uint64_t src_length, const IoCtx& tgt_ioctx, | |
750 | std::string tgt_oid, uint64_t tgt_offset, int flag = 0); | |
751 | /** | |
752 | * flush a manifest tier object to backing tier; will block racing | |
753 | * updates. | |
754 | */ | |
755 | void tier_flush(); | |
756 | /** | |
757 | * evict a manifest tier object to backing tier; will block racing | |
758 | * updates. | |
759 | */ | |
760 | void tier_evict(); | |
7c673cae FG |
761 | }; |
762 | ||
763 | /* IoCtx : This is a context in which we can perform I/O. | |
764 | * It includes a Pool, | |
765 | * | |
766 | * Typical use (error checking omitted): | |
767 | * | |
768 | * IoCtx p; | |
769 | * rados.ioctx_create("my_pool", p); | |
770 | * p->stat(&stats); | |
771 | * ... etc ... | |
772 | * | |
773 | * NOTE: be sure to call watch_flush() prior to destroying any IoCtx | |
774 | * that is used for watch events to ensure that racing callbacks | |
775 | * have completed. | |
776 | */ | |
777 | class CEPH_RADOS_API IoCtx | |
778 | { | |
779 | public: | |
780 | IoCtx(); | |
781 | static void from_rados_ioctx_t(rados_ioctx_t p, IoCtx &pool); | |
782 | IoCtx(const IoCtx& rhs); | |
783 | IoCtx& operator=(const IoCtx& rhs); | |
11fdf7f2 TL |
784 | IoCtx(IoCtx&& rhs) noexcept; |
785 | IoCtx& operator=(IoCtx&& rhs) noexcept; | |
7c673cae FG |
786 | |
787 | ~IoCtx(); | |
788 | ||
eafe8130 TL |
789 | bool is_valid() const; |
790 | ||
7c673cae FG |
791 | // Close our pool handle |
792 | void close(); | |
793 | ||
794 | // deep copy | |
795 | void dup(const IoCtx& rhs); | |
796 | ||
797 | // set pool auid | |
11fdf7f2 TL |
798 | int set_auid(uint64_t auid_) |
799 | __attribute__ ((deprecated)); | |
7c673cae FG |
800 | |
801 | // set pool auid | |
11fdf7f2 TL |
802 | int set_auid_async(uint64_t auid_, PoolAsyncCompletion *c) |
803 | __attribute__ ((deprecated)); | |
7c673cae FG |
804 | |
805 | // get pool auid | |
11fdf7f2 TL |
806 | int get_auid(uint64_t *auid_) |
807 | __attribute__ ((deprecated)); | |
7c673cae FG |
808 | |
809 | uint64_t get_instance_id() const; | |
810 | ||
811 | std::string get_pool_name(); | |
812 | ||
813 | bool pool_requires_alignment(); | |
11fdf7f2 | 814 | int pool_requires_alignment2(bool * req); |
7c673cae FG |
815 | uint64_t pool_required_alignment(); |
816 | int pool_required_alignment2(uint64_t * alignment); | |
817 | ||
818 | // create an object | |
819 | int create(const std::string& oid, bool exclusive); | |
820 | int create(const std::string& oid, bool exclusive, | |
821 | const std::string& category); ///< category is unused | |
822 | ||
823 | /** | |
824 | * write bytes to an object at a specified offset | |
825 | * | |
826 | * NOTE: this call steals the contents of @param bl. | |
827 | */ | |
828 | int write(const std::string& oid, bufferlist& bl, size_t len, uint64_t off); | |
829 | /** | |
830 | * append bytes to an object | |
831 | * | |
832 | * NOTE: this call steals the contents of @param bl. | |
833 | */ | |
834 | int append(const std::string& oid, bufferlist& bl, size_t len); | |
835 | /** | |
836 | * replace object contents with provided data | |
837 | * | |
838 | * NOTE: this call steals the contents of @param bl. | |
839 | */ | |
840 | int write_full(const std::string& oid, bufferlist& bl); | |
841 | int writesame(const std::string& oid, bufferlist& bl, | |
842 | size_t write_len, uint64_t off); | |
843 | int read(const std::string& oid, bufferlist& bl, size_t len, uint64_t off); | |
844 | int checksum(const std::string& o, rados_checksum_type_t type, | |
845 | const bufferlist &init_value_bl, size_t len, uint64_t off, | |
846 | size_t chunk_size, bufferlist *pbl); | |
847 | int remove(const std::string& oid); | |
848 | int remove(const std::string& oid, int flags); | |
849 | int trunc(const std::string& oid, uint64_t size); | |
850 | int mapext(const std::string& o, uint64_t off, size_t len, std::map<uint64_t,uint64_t>& m); | |
851 | int cmpext(const std::string& o, uint64_t off, bufferlist& cmp_bl); | |
852 | int sparse_read(const std::string& o, std::map<uint64_t,uint64_t>& m, bufferlist& bl, size_t len, uint64_t off); | |
853 | int getxattr(const std::string& oid, const char *name, bufferlist& bl); | |
854 | int getxattrs(const std::string& oid, std::map<std::string, bufferlist>& attrset); | |
855 | int setxattr(const std::string& oid, const char *name, bufferlist& bl); | |
856 | int rmxattr(const std::string& oid, const char *name); | |
857 | int stat(const std::string& oid, uint64_t *psize, time_t *pmtime); | |
858 | int stat2(const std::string& oid, uint64_t *psize, struct timespec *pts); | |
859 | int exec(const std::string& oid, const char *cls, const char *method, | |
860 | bufferlist& inbl, bufferlist& outbl); | |
861 | /** | |
862 | * modify object tmap based on encoded update sequence | |
863 | * | |
864 | * NOTE: this call steals the contents of @param bl | |
865 | */ | |
866 | int tmap_update(const std::string& oid, bufferlist& cmdbl); | |
7c673cae FG |
867 | |
868 | int omap_get_vals(const std::string& oid, | |
869 | const std::string& start_after, | |
870 | uint64_t max_return, | |
871 | std::map<std::string, bufferlist> *out_vals); | |
872 | int omap_get_vals2(const std::string& oid, | |
873 | const std::string& start_after, | |
874 | uint64_t max_return, | |
875 | std::map<std::string, bufferlist> *out_vals, | |
876 | bool *pmore); | |
877 | int omap_get_vals(const std::string& oid, | |
878 | const std::string& start_after, | |
879 | const std::string& filter_prefix, | |
880 | uint64_t max_return, | |
881 | std::map<std::string, bufferlist> *out_vals); | |
882 | int omap_get_vals2(const std::string& oid, | |
883 | const std::string& start_after, | |
884 | const std::string& filter_prefix, | |
885 | uint64_t max_return, | |
886 | std::map<std::string, bufferlist> *out_vals, | |
887 | bool *pmore); | |
888 | int omap_get_keys(const std::string& oid, | |
889 | const std::string& start_after, | |
890 | uint64_t max_return, | |
891 | std::set<std::string> *out_keys); | |
892 | int omap_get_keys2(const std::string& oid, | |
893 | const std::string& start_after, | |
894 | uint64_t max_return, | |
895 | std::set<std::string> *out_keys, | |
896 | bool *pmore); | |
897 | int omap_get_header(const std::string& oid, | |
898 | bufferlist *bl); | |
899 | int omap_get_vals_by_keys(const std::string& oid, | |
900 | const std::set<std::string>& keys, | |
901 | std::map<std::string, bufferlist> *vals); | |
902 | int omap_set(const std::string& oid, | |
903 | const std::map<std::string, bufferlist>& map); | |
904 | int omap_set_header(const std::string& oid, | |
905 | const bufferlist& bl); | |
906 | int omap_clear(const std::string& oid); | |
907 | int omap_rm_keys(const std::string& oid, | |
908 | const std::set<std::string>& keys); | |
909 | ||
910 | void snap_set_read(snap_t seq); | |
911 | int selfmanaged_snap_set_write_ctx(snap_t seq, std::vector<snap_t>& snaps); | |
912 | ||
913 | // Create a snapshot with a given name | |
914 | int snap_create(const char *snapname); | |
915 | ||
916 | // Look up a snapshot by name. | |
917 | // Returns 0 on success; error code otherwise | |
918 | int snap_lookup(const char *snapname, snap_t *snap); | |
919 | ||
920 | // Gets a timestamp for a snap | |
921 | int snap_get_stamp(snap_t snapid, time_t *t); | |
922 | ||
923 | // Gets the name of a snap | |
924 | int snap_get_name(snap_t snapid, std::string *s); | |
925 | ||
926 | // Remove a snapshot from this pool | |
927 | int snap_remove(const char *snapname); | |
928 | ||
929 | int snap_list(std::vector<snap_t> *snaps); | |
930 | ||
931 | int snap_rollback(const std::string& oid, const char *snapname); | |
932 | ||
933 | // Deprecated name kept for backward compatibility - same as snap_rollback() | |
934 | int rollback(const std::string& oid, const char *snapname) | |
935 | __attribute__ ((deprecated)); | |
936 | ||
937 | int selfmanaged_snap_create(uint64_t *snapid); | |
938 | void aio_selfmanaged_snap_create(uint64_t *snapid, AioCompletion *c); | |
939 | ||
940 | int selfmanaged_snap_remove(uint64_t snapid); | |
941 | void aio_selfmanaged_snap_remove(uint64_t snapid, AioCompletion *c); | |
942 | ||
943 | int selfmanaged_snap_rollback(const std::string& oid, uint64_t snapid); | |
944 | ||
945 | // Advisory locking on rados objects. | |
946 | int lock_exclusive(const std::string &oid, const std::string &name, | |
947 | const std::string &cookie, | |
948 | const std::string &description, | |
949 | struct timeval * duration, uint8_t flags); | |
950 | ||
951 | int lock_shared(const std::string &oid, const std::string &name, | |
952 | const std::string &cookie, const std::string &tag, | |
953 | const std::string &description, | |
954 | struct timeval * duration, uint8_t flags); | |
955 | ||
956 | int unlock(const std::string &oid, const std::string &name, | |
957 | const std::string &cookie); | |
958 | ||
959 | int break_lock(const std::string &oid, const std::string &name, | |
960 | const std::string &client, const std::string &cookie); | |
961 | ||
962 | int list_lockers(const std::string &oid, const std::string &name, | |
963 | int *exclusive, | |
964 | std::string *tag, | |
965 | std::list<librados::locker_t> *lockers); | |
966 | ||
967 | ||
f64942e4 | 968 | /// Start enumerating objects for a pool. Errors are thrown as exceptions. |
11fdf7f2 | 969 | NObjectIterator nobjects_begin(const bufferlist &filter=bufferlist()); |
f64942e4 AA |
970 | /// Start enumerating objects for a pool starting from a hash position. |
971 | /// Errors are thrown as exceptions. | |
7c673cae | 972 | NObjectIterator nobjects_begin(uint32_t start_hash_position, |
11fdf7f2 | 973 | const bufferlist &filter=bufferlist()); |
f64942e4 AA |
974 | /// Start enumerating objects for a pool starting from cursor. Errors are |
975 | /// thrown as exceptions. | |
7c673cae | 976 | NObjectIterator nobjects_begin(const librados::ObjectCursor& cursor, |
11fdf7f2 | 977 | const bufferlist &filter=bufferlist()); |
7c673cae FG |
978 | /// Iterator indicating the end of a pool |
979 | const NObjectIterator& nobjects_end() const; | |
980 | ||
981 | /// Get cursor for pool beginning | |
982 | ObjectCursor object_list_begin(); | |
983 | ||
984 | /// Get cursor for pool end | |
985 | ObjectCursor object_list_end(); | |
986 | ||
987 | /// Check whether a cursor is at the end of a pool | |
988 | bool object_list_is_end(const ObjectCursor &oc); | |
989 | ||
990 | /// List some objects between two cursors | |
991 | int object_list(const ObjectCursor &start, const ObjectCursor &finish, | |
992 | const size_t result_count, | |
993 | const bufferlist &filter, | |
994 | std::vector<ObjectItem> *result, | |
995 | ObjectCursor *next); | |
996 | ||
997 | /// Generate cursors that include the N out of Mth slice of the pool | |
998 | void object_list_slice( | |
999 | const ObjectCursor start, | |
1000 | const ObjectCursor finish, | |
1001 | const size_t n, | |
1002 | const size_t m, | |
1003 | ObjectCursor *split_start, | |
1004 | ObjectCursor *split_finish); | |
1005 | ||
1006 | /** | |
1007 | * List available hit set objects | |
1008 | * | |
1009 | * @param uint32_t [in] hash position to query | |
1010 | * @param c [in] completion | |
1011 | * @param pls [out] list of available intervals | |
1012 | */ | |
1013 | int hit_set_list(uint32_t hash, AioCompletion *c, | |
1014 | std::list< std::pair<time_t, time_t> > *pls); | |
1015 | ||
1016 | /** | |
1017 | * Retrieve hit set for a given hash, and time | |
1018 | * | |
1019 | * @param hash [in] hash position | |
1020 | * @param c [in] completion | |
1021 | * @param stamp [in] time interval that falls within the hit set's interval | |
1022 | * @param pbl [out] buffer to store the result in | |
1023 | */ | |
1024 | int hit_set_get(uint32_t hash, AioCompletion *c, time_t stamp, | |
1025 | bufferlist *pbl); | |
1026 | ||
1027 | uint64_t get_last_version(); | |
1028 | ||
1029 | int aio_read(const std::string& oid, AioCompletion *c, | |
1030 | bufferlist *pbl, size_t len, uint64_t off); | |
1031 | /** | |
1032 | * Asynchronously read from an object at a particular snapshot | |
1033 | * | |
1034 | * This is the same as normal aio_read, except that it chooses | |
1035 | * the snapshot to read from from its arguments instead of the | |
1036 | * internal IoCtx state. | |
1037 | * | |
1038 | * The return value of the completion will be number of bytes read on | |
1039 | * success, negative error code on failure. | |
1040 | * | |
1041 | * @param oid the name of the object to read from | |
1042 | * @param c what to do when the read is complete | |
1043 | * @param pbl where to store the results | |
1044 | * @param len the number of bytes to read | |
1045 | * @param off the offset to start reading from in the object | |
1046 | * @param snapid the id of the snapshot to read from | |
1047 | * @returns 0 on success, negative error code on failure | |
1048 | */ | |
1049 | int aio_read(const std::string& oid, AioCompletion *c, | |
1050 | bufferlist *pbl, size_t len, uint64_t off, uint64_t snapid); | |
1051 | int aio_sparse_read(const std::string& oid, AioCompletion *c, | |
1052 | std::map<uint64_t,uint64_t> *m, bufferlist *data_bl, | |
1053 | size_t len, uint64_t off); | |
1054 | /** | |
1055 | * Asynchronously read existing extents from an object at a | |
1056 | * particular snapshot | |
1057 | * | |
1058 | * This is the same as normal aio_sparse_read, except that it chooses | |
1059 | * the snapshot to read from from its arguments instead of the | |
1060 | * internal IoCtx state. | |
1061 | * | |
1062 | * m will be filled in with a map of extents in the object, | |
1063 | * mapping offsets to lengths (in bytes) within the range | |
1064 | * requested. The data for all of the extents are stored | |
1065 | * back-to-back in offset order in data_bl. | |
1066 | * | |
1067 | * @param oid the name of the object to read from | |
1068 | * @param c what to do when the read is complete | |
1069 | * @param m where to store the map of extents | |
1070 | * @param data_bl where to store the data | |
1071 | * @param len the number of bytes to read | |
1072 | * @param off the offset to start reading from in the object | |
1073 | * @param snapid the id of the snapshot to read from | |
1074 | * @returns 0 on success, negative error code on failure | |
1075 | */ | |
1076 | int aio_sparse_read(const std::string& oid, AioCompletion *c, | |
1077 | std::map<uint64_t,uint64_t> *m, bufferlist *data_bl, | |
1078 | size_t len, uint64_t off, uint64_t snapid); | |
1079 | /** | |
1080 | * Asynchronously compare an on-disk object range with a buffer | |
1081 | * | |
1082 | * @param oid the name of the object to read from | |
1083 | * @param c what to do when the read is complete | |
1084 | * @param off object byte offset at which to start the comparison | |
1085 | * @param cmp_bl buffer containing bytes to be compared with object contents | |
1086 | * @returns 0 on success, negative error code on failure, | |
1087 | * (-MAX_ERRNO - mismatch_off) on mismatch | |
1088 | */ | |
1089 | int aio_cmpext(const std::string& oid, | |
1090 | librados::AioCompletion *c, | |
1091 | uint64_t off, | |
1092 | bufferlist& cmp_bl); | |
1093 | int aio_write(const std::string& oid, AioCompletion *c, const bufferlist& bl, | |
1094 | size_t len, uint64_t off); | |
1095 | int aio_append(const std::string& oid, AioCompletion *c, const bufferlist& bl, | |
1096 | size_t len); | |
1097 | int aio_write_full(const std::string& oid, AioCompletion *c, const bufferlist& bl); | |
1098 | int aio_writesame(const std::string& oid, AioCompletion *c, const bufferlist& bl, | |
1099 | size_t write_len, uint64_t off); | |
1100 | ||
1101 | /** | |
11fdf7f2 | 1102 | * Asynchronously remove an object |
7c673cae FG |
1103 | * |
1104 | * Queues the remove and returns. | |
1105 | * | |
1106 | * The return value of the completion will be 0 on success, negative | |
1107 | * error code on failure. | |
1108 | * | |
1109 | * @param oid the name of the object | |
1110 | * @param c what to do when the remove is safe and complete | |
1111 | * @returns 0 on success, -EROFS if the io context specifies a snap_seq | |
1112 | * other than SNAP_HEAD | |
1113 | */ | |
1114 | int aio_remove(const std::string& oid, AioCompletion *c); | |
1115 | int aio_remove(const std::string& oid, AioCompletion *c, int flags); | |
1116 | ||
1117 | /** | |
1118 | * Wait for all currently pending aio writes to be safe. | |
1119 | * | |
1120 | * @returns 0 on success, negative error code on failure | |
1121 | */ | |
1122 | int aio_flush(); | |
1123 | ||
1124 | /** | |
1125 | * Schedule a callback for when all currently pending | |
1126 | * aio writes are safe. This is a non-blocking version of | |
1127 | * aio_flush(). | |
1128 | * | |
1129 | * @param c what to do when the writes are safe | |
1130 | * @returns 0 on success, negative error code on failure | |
1131 | */ | |
1132 | int aio_flush_async(AioCompletion *c); | |
1133 | int aio_getxattr(const std::string& oid, AioCompletion *c, const char *name, bufferlist& bl); | |
1134 | int aio_getxattrs(const std::string& oid, AioCompletion *c, std::map<std::string, bufferlist>& attrset); | |
1135 | int aio_setxattr(const std::string& oid, AioCompletion *c, const char *name, bufferlist& bl); | |
1136 | int aio_rmxattr(const std::string& oid, AioCompletion *c, const char *name); | |
1137 | int aio_stat(const std::string& oid, AioCompletion *c, uint64_t *psize, time_t *pmtime); | |
1138 | int aio_stat2(const std::string& oid, AioCompletion *c, uint64_t *psize, struct timespec *pts); | |
1139 | ||
1140 | /** | |
1141 | * Cancel aio operation | |
1142 | * | |
1143 | * @param c completion handle | |
1144 | * @returns 0 on success, negative error code on failure | |
1145 | */ | |
1146 | int aio_cancel(AioCompletion *c); | |
1147 | ||
1148 | int aio_exec(const std::string& oid, AioCompletion *c, const char *cls, const char *method, | |
1149 | bufferlist& inbl, bufferlist *outbl); | |
1150 | ||
1151 | /* | |
1152 | * asynchronous version of unlock | |
1153 | */ | |
1154 | int aio_unlock(const std::string &oid, const std::string &name, | |
1155 | const std::string &cookie, AioCompletion *c); | |
1156 | ||
1157 | // compound object operations | |
1158 | int operate(const std::string& oid, ObjectWriteOperation *op); | |
9f95a23c | 1159 | int operate(const std::string& oid, ObjectWriteOperation *op, int flags); |
7c673cae | 1160 | int operate(const std::string& oid, ObjectReadOperation *op, bufferlist *pbl); |
9f95a23c | 1161 | int operate(const std::string& oid, ObjectReadOperation *op, bufferlist *pbl, int flags); |
7c673cae FG |
1162 | int aio_operate(const std::string& oid, AioCompletion *c, ObjectWriteOperation *op); |
1163 | int aio_operate(const std::string& oid, AioCompletion *c, ObjectWriteOperation *op, int flags); | |
1164 | /** | |
1165 | * Schedule an async write operation with explicit snapshot parameters | |
1166 | * | |
1167 | * This is the same as the first aio_operate(), except that it | |
1168 | * gets the snapshot context from its arguments instead of the | |
1169 | * IoCtx internal state. | |
1170 | * | |
1171 | * @param oid the object to operate on | |
1172 | * @param c what to do when the operation is complete and safe | |
1173 | * @param op which operations to perform | |
1174 | * @param seq latest selfmanaged snapshot sequence number for this object | |
1175 | * @param snaps currently existing selfmanaged snapshot ids for this object | |
1176 | * @returns 0 on success, negative error code on failure | |
1177 | */ | |
1178 | int aio_operate(const std::string& oid, AioCompletion *c, | |
1179 | ObjectWriteOperation *op, snap_t seq, | |
1180 | std::vector<snap_t>& snaps); | |
1181 | int aio_operate(const std::string& oid, AioCompletion *c, | |
1182 | ObjectWriteOperation *op, snap_t seq, | |
1183 | std::vector<snap_t>& snaps, | |
1184 | const blkin_trace_info *trace_info); | |
11fdf7f2 TL |
1185 | int aio_operate(const std::string& oid, AioCompletion *c, |
1186 | ObjectWriteOperation *op, snap_t seq, | |
1187 | std::vector<snap_t>& snaps, int flags, | |
1188 | const blkin_trace_info *trace_info); | |
7c673cae FG |
1189 | int aio_operate(const std::string& oid, AioCompletion *c, |
1190 | ObjectReadOperation *op, bufferlist *pbl); | |
1191 | ||
1192 | int aio_operate(const std::string& oid, AioCompletion *c, | |
1193 | ObjectReadOperation *op, snap_t snapid, int flags, | |
1194 | bufferlist *pbl) | |
1195 | __attribute__ ((deprecated)); | |
1196 | ||
1197 | int aio_operate(const std::string& oid, AioCompletion *c, | |
1198 | ObjectReadOperation *op, int flags, | |
1199 | bufferlist *pbl); | |
1200 | int aio_operate(const std::string& oid, AioCompletion *c, | |
1201 | ObjectReadOperation *op, int flags, | |
1202 | bufferlist *pbl, const blkin_trace_info *trace_info); | |
1203 | ||
1204 | // watch/notify | |
1205 | int watch2(const std::string& o, uint64_t *handle, | |
1206 | librados::WatchCtx2 *ctx); | |
1207 | int watch3(const std::string& o, uint64_t *handle, | |
1208 | librados::WatchCtx2 *ctx, uint32_t timeout); | |
1209 | int aio_watch(const std::string& o, AioCompletion *c, uint64_t *handle, | |
1210 | librados::WatchCtx2 *ctx); | |
1211 | int aio_watch2(const std::string& o, AioCompletion *c, uint64_t *handle, | |
1212 | librados::WatchCtx2 *ctx, uint32_t timeout); | |
1213 | int unwatch2(uint64_t handle); | |
1214 | int aio_unwatch(uint64_t handle, AioCompletion *c); | |
1215 | /** | |
11fdf7f2 | 1216 | * Send a notify event to watchers |
7c673cae FG |
1217 | * |
1218 | * Upon completion the pbl bufferlist reply payload will be | |
1219 | * encoded like so: | |
1220 | * | |
1221 | * le32 num_acks | |
1222 | * { | |
1223 | * le64 gid global id for the client (for client.1234 that's 1234) | |
1224 | * le64 cookie cookie for the client | |
1225 | * le32 buflen length of reply message buffer | |
1226 | * u8 * buflen payload | |
1227 | * } * num_acks | |
1228 | * le32 num_timeouts | |
1229 | * { | |
1230 | * le64 gid global id for the client | |
1231 | * le64 cookie cookie for the client | |
1232 | * } * num_timeouts | |
1233 | * | |
1234 | * | |
1235 | */ | |
1236 | int notify2(const std::string& o, ///< object | |
1237 | bufferlist& bl, ///< optional broadcast payload | |
1238 | uint64_t timeout_ms, ///< timeout (in ms) | |
1239 | bufferlist *pbl); ///< reply buffer | |
1240 | int aio_notify(const std::string& o, ///< object | |
1241 | AioCompletion *c, ///< completion when notify completes | |
1242 | bufferlist& bl, ///< optional broadcast payload | |
1243 | uint64_t timeout_ms, ///< timeout (in ms) | |
1244 | bufferlist *pbl); ///< reply buffer | |
f67539c2 TL |
1245 | /* |
1246 | * Decode a notify response into acks and timeout vectors. | |
1247 | */ | |
1248 | void decode_notify_response(bufferlist &bl, | |
1249 | std::vector<librados::notify_ack_t> *acks, | |
1250 | std::vector<librados::notify_timeout_t> *timeouts); | |
7c673cae FG |
1251 | |
1252 | int list_watchers(const std::string& o, std::list<obj_watch_t> *out_watchers); | |
1253 | int list_snaps(const std::string& o, snap_set_t *out_snaps); | |
1254 | void set_notify_timeout(uint32_t timeout); | |
1255 | ||
1256 | /// acknowledge a notify we received. | |
1257 | void notify_ack(const std::string& o, ///< watched object | |
1258 | uint64_t notify_id, ///< notify id | |
1259 | uint64_t cookie, ///< our watch handle | |
1260 | bufferlist& bl); ///< optional reply payload | |
1261 | ||
1262 | /*** | |
1263 | * check on watch validity | |
1264 | * | |
1265 | * Check if a watch is valid. If so, return the number of | |
1266 | * milliseconds since we last confirmed its liveness. If there is | |
1267 | * a known error, return it. | |
1268 | * | |
1269 | * If there is an error, the watch is no longer valid, and should | |
11fdf7f2 TL |
1270 | * be destroyed with unwatch(). The user is still interested in |
1271 | * the object, a new watch should be created with watch(). | |
7c673cae FG |
1272 | * |
1273 | * @param cookie watch handle | |
1274 | * @returns ms since last confirmed valid, or error | |
1275 | */ | |
1276 | int watch_check(uint64_t cookie); | |
1277 | ||
1278 | // old, deprecated versions | |
1279 | int watch(const std::string& o, uint64_t ver, uint64_t *cookie, | |
1280 | librados::WatchCtx *ctx) __attribute__ ((deprecated)); | |
1281 | int notify(const std::string& o, uint64_t ver, bufferlist& bl) | |
1282 | __attribute__ ((deprecated)); | |
1283 | int unwatch(const std::string& o, uint64_t cookie) | |
1284 | __attribute__ ((deprecated)); | |
1285 | ||
1286 | /** | |
1287 | * Set allocation hint for an object | |
1288 | * | |
1289 | * This is an advisory operation, it will always succeed (as if it | |
1290 | * was submitted with a OP_FAILOK flag set) and is not guaranteed | |
1291 | * to do anything on the backend. | |
1292 | * | |
1293 | * @param o the name of the object | |
1294 | * @param expected_object_size expected size of the object, in bytes | |
1295 | * @param expected_write_size expected size of writes to the object, in bytes | |
1296 | * @returns 0 on success, negative error code on failure | |
1297 | */ | |
1298 | int set_alloc_hint(const std::string& o, | |
1299 | uint64_t expected_object_size, | |
1300 | uint64_t expected_write_size); | |
1301 | int set_alloc_hint2(const std::string& o, | |
1302 | uint64_t expected_object_size, | |
1303 | uint64_t expected_write_size, | |
1304 | uint32_t flags); | |
1305 | ||
1306 | // assert version for next sync operations | |
1307 | void set_assert_version(uint64_t ver); | |
1308 | ||
1309 | /** | |
1310 | * Pin/unpin an object in cache tier | |
1311 | * | |
1312 | * @param o the name of the object | |
1313 | * @returns 0 on success, negative error code on failure | |
1314 | */ | |
1315 | int cache_pin(const std::string& o); | |
1316 | int cache_unpin(const std::string& o); | |
1317 | ||
1318 | std::string get_pool_name() const; | |
1319 | ||
1320 | void locator_set_key(const std::string& key); | |
1321 | void set_namespace(const std::string& nspace); | |
11fdf7f2 | 1322 | std::string get_namespace() const; |
7c673cae FG |
1323 | |
1324 | int64_t get_id(); | |
1325 | ||
1326 | // deprecated versions | |
1327 | uint32_t get_object_hash_position(const std::string& oid) | |
1328 | __attribute__ ((deprecated)); | |
1329 | uint32_t get_object_pg_hash_position(const std::string& oid) | |
1330 | __attribute__ ((deprecated)); | |
1331 | ||
1332 | int get_object_hash_position2(const std::string& oid, uint32_t *hash_position); | |
1333 | int get_object_pg_hash_position2(const std::string& oid, uint32_t *pg_hash_position); | |
1334 | ||
1335 | config_t cct(); | |
1336 | ||
9f95a23c TL |
1337 | void set_osdmap_full_try() |
1338 | __attribute__ ((deprecated)); | |
1339 | void unset_osdmap_full_try() | |
1340 | __attribute__ ((deprecated)); | |
1341 | ||
1342 | void set_pool_full_try(); | |
1343 | void unset_pool_full_try(); | |
7c673cae | 1344 | |
c07f9fc5 FG |
1345 | int application_enable(const std::string& app_name, bool force); |
1346 | int application_enable_async(const std::string& app_name, | |
1347 | bool force, PoolAsyncCompletion *c); | |
1348 | int application_list(std::set<std::string> *app_names); | |
1349 | int application_metadata_get(const std::string& app_name, | |
1350 | const std::string &key, | |
1351 | std::string *value); | |
1352 | int application_metadata_set(const std::string& app_name, | |
1353 | const std::string &key, | |
1354 | const std::string& value); | |
1355 | int application_metadata_remove(const std::string& app_name, | |
1356 | const std::string &key); | |
1357 | int application_metadata_list(const std::string& app_name, | |
1358 | std::map<std::string, std::string> *values); | |
1359 | ||
7c673cae FG |
1360 | private: |
1361 | /* You can only get IoCtx instances from Rados */ | |
1362 | IoCtx(IoCtxImpl *io_ctx_impl_); | |
1363 | ||
1364 | friend class Rados; // Only Rados can use our private constructor to create IoCtxes. | |
1365 | friend class libradosstriper::RadosStriper; // Striper needs to see our IoCtxImpl | |
1366 | friend class ObjectWriteOperation; // copy_from needs to see our IoCtxImpl | |
f67539c2 | 1367 | friend class ObjectReadOperation; // set_chunk needs to see our IoCtxImpl |
7c673cae FG |
1368 | |
1369 | IoCtxImpl *io_ctx_impl; | |
1370 | }; | |
1371 | ||
7c673cae FG |
1372 | struct CEPH_RADOS_API PlacementGroup { |
1373 | PlacementGroup(); | |
1374 | PlacementGroup(const PlacementGroup&); | |
1375 | ~PlacementGroup(); | |
1376 | bool parse(const char*); | |
1377 | std::unique_ptr<PlacementGroupImpl> impl; | |
1378 | }; | |
1379 | ||
1380 | CEPH_RADOS_API std::ostream& operator<<(std::ostream&, const PlacementGroup&); | |
1381 | ||
1382 | class CEPH_RADOS_API Rados | |
1383 | { | |
1384 | public: | |
1385 | static void version(int *major, int *minor, int *extra); | |
1386 | ||
1387 | Rados(); | |
1388 | explicit Rados(IoCtx& ioctx); | |
1389 | ~Rados(); | |
eafe8130 | 1390 | static void from_rados_t(rados_t cluster, Rados &rados); |
7c673cae FG |
1391 | |
1392 | int init(const char * const id); | |
1393 | int init2(const char * const name, const char * const clustername, | |
1394 | uint64_t flags); | |
1395 | int init_with_context(config_t cct_); | |
1396 | config_t cct(); | |
1397 | int connect(); | |
1398 | void shutdown(); | |
1399 | int watch_flush(); | |
1400 | int aio_watch_flush(AioCompletion*); | |
1401 | int conf_read_file(const char * const path) const; | |
1402 | int conf_parse_argv(int argc, const char ** argv) const; | |
1403 | int conf_parse_argv_remainder(int argc, const char ** argv, | |
1404 | const char ** remargv) const; | |
1405 | int conf_parse_env(const char *env) const; | |
1406 | int conf_set(const char *option, const char *value); | |
1407 | int conf_get(const char *option, std::string &val); | |
1408 | ||
224ce89b WB |
1409 | int service_daemon_register( |
1410 | const std::string& service, ///< service name (e.g., 'rgw') | |
1411 | const std::string& name, ///< daemon name (e.g., 'gwfoo') | |
1412 | const std::map<std::string,std::string>& metadata); ///< static metadata about daemon | |
1413 | int service_daemon_update_status( | |
11fdf7f2 | 1414 | std::map<std::string,std::string>&& status); |
224ce89b | 1415 | |
7c673cae | 1416 | int pool_create(const char *name); |
11fdf7f2 TL |
1417 | int pool_create(const char *name, uint64_t auid) |
1418 | __attribute__ ((deprecated)); | |
1419 | int pool_create(const char *name, uint64_t auid, uint8_t crush_rule) | |
1420 | __attribute__ ((deprecated)); | |
1421 | int pool_create_with_rule(const char *name, uint8_t crush_rule); | |
7c673cae | 1422 | int pool_create_async(const char *name, PoolAsyncCompletion *c); |
11fdf7f2 TL |
1423 | int pool_create_async(const char *name, uint64_t auid, PoolAsyncCompletion *c) |
1424 | __attribute__ ((deprecated)); | |
1425 | int pool_create_async(const char *name, uint64_t auid, uint8_t crush_rule, PoolAsyncCompletion *c) | |
1426 | __attribute__ ((deprecated)); | |
1427 | int pool_create_with_rule_async(const char *name, uint8_t crush_rule, PoolAsyncCompletion *c); | |
7c673cae FG |
1428 | int pool_get_base_tier(int64_t pool, int64_t* base_tier); |
1429 | int pool_delete(const char *name); | |
1430 | int pool_delete_async(const char *name, PoolAsyncCompletion *c); | |
1431 | int64_t pool_lookup(const char *name); | |
1432 | int pool_reverse_lookup(int64_t id, std::string *name); | |
1433 | ||
1434 | uint64_t get_instance_id(); | |
1435 | ||
11fdf7f2 TL |
1436 | int get_min_compatible_osd(int8_t* require_osd_release); |
1437 | int get_min_compatible_client(int8_t* min_compat_client, | |
1438 | int8_t* require_min_compat_client); | |
1439 | ||
7c673cae FG |
1440 | int mon_command(std::string cmd, const bufferlist& inbl, |
1441 | bufferlist *outbl, std::string *outs); | |
1442 | int mgr_command(std::string cmd, const bufferlist& inbl, | |
1443 | bufferlist *outbl, std::string *outs); | |
1444 | int osd_command(int osdid, std::string cmd, const bufferlist& inbl, | |
1445 | bufferlist *outbl, std::string *outs); | |
1446 | int pg_command(const char *pgstr, std::string cmd, const bufferlist& inbl, | |
1447 | bufferlist *outbl, std::string *outs); | |
1448 | ||
1449 | int ioctx_create(const char *name, IoCtx &pioctx); | |
1450 | int ioctx_create2(int64_t pool_id, IoCtx &pioctx); | |
1451 | ||
1452 | // Features useful for test cases | |
f67539c2 | 1453 | void test_blocklist_self(bool set); |
7c673cae FG |
1454 | |
1455 | /* pool info */ | |
1456 | int pool_list(std::list<std::string>& v); | |
1457 | int pool_list2(std::list<std::pair<int64_t, std::string> >& v); | |
1458 | int get_pool_stats(std::list<std::string>& v, | |
1459 | stats_map& result); | |
1460 | /// deprecated; use simpler form. categories no longer supported. | |
1461 | int get_pool_stats(std::list<std::string>& v, | |
1462 | std::map<std::string, stats_map>& stats); | |
1463 | /// deprecated; categories no longer supported | |
1464 | int get_pool_stats(std::list<std::string>& v, | |
1465 | std::string& category, | |
1466 | std::map<std::string, stats_map>& stats); | |
1467 | /// check if pool has selfmanaged snaps | |
1468 | bool get_pool_is_selfmanaged_snaps_mode(const std::string& poolname); | |
1469 | ||
1470 | int cluster_stat(cluster_stat_t& result); | |
1471 | int cluster_fsid(std::string *fsid); | |
1472 | ||
1473 | /** | |
1474 | * List inconsistent placement groups in the given pool | |
1475 | * | |
1476 | * @param pool_id the pool id | |
1477 | * @param pgs [out] the inconsistent PGs | |
1478 | */ | |
1479 | int get_inconsistent_pgs(int64_t pool_id, | |
1480 | std::vector<PlacementGroup>* pgs); | |
1481 | /** | |
1482 | * List the inconsistent objects found in a given PG by last scrub | |
1483 | * | |
1484 | * @param pg the placement group returned by @c pg_list() | |
1485 | * @param start_after the first returned @c objects | |
1486 | * @param max_return the max number of the returned @c objects | |
1487 | * @param c what to do when the operation is complete and safe | |
1488 | * @param objects [out] the objects where inconsistencies are found | |
1489 | * @param interval [in,out] an epoch indicating current interval | |
1490 | * @returns if a non-zero @c interval is specified, will return -EAGAIN i | |
1491 | * the current interval begin epoch is different. | |
1492 | */ | |
1493 | int get_inconsistent_objects(const PlacementGroup& pg, | |
1494 | const object_id_t &start_after, | |
1495 | unsigned max_return, | |
1496 | AioCompletion *c, | |
1497 | std::vector<inconsistent_obj_t>* objects, | |
1498 | uint32_t* interval); | |
1499 | /** | |
1500 | * List the inconsistent snapsets found in a given PG by last scrub | |
1501 | * | |
1502 | * @param pg the placement group returned by @c pg_list() | |
1503 | * @param start_after the first returned @c objects | |
1504 | * @param max_return the max number of the returned @c objects | |
1505 | * @param c what to do when the operation is complete and safe | |
1506 | * @param snapsets [out] the objects where inconsistencies are found | |
1507 | * @param interval [in,out] an epoch indicating current interval | |
1508 | * @returns if a non-zero @c interval is specified, will return -EAGAIN i | |
1509 | * the current interval begin epoch is different. | |
1510 | */ | |
1511 | int get_inconsistent_snapsets(const PlacementGroup& pg, | |
1512 | const object_id_t &start_after, | |
1513 | unsigned max_return, | |
1514 | AioCompletion *c, | |
1515 | std::vector<inconsistent_snapset_t>* snapset, | |
1516 | uint32_t* interval); | |
1517 | ||
1518 | /// get/wait for the most recent osdmap | |
1519 | int wait_for_latest_osdmap(); | |
1520 | ||
f67539c2 | 1521 | int blocklist_add(const std::string& client_address, |
7c673cae FG |
1522 | uint32_t expire_seconds); |
1523 | ||
f67539c2 TL |
1524 | std::string get_addrs() const; |
1525 | ||
7c673cae FG |
1526 | /* |
1527 | * pool aio | |
1528 | * | |
1529 | * It is up to the caller to release the completion handler, even if the pool_create_async() | |
1530 | * and/or pool_delete_async() fails and does not send the async request | |
1531 | */ | |
1532 | static PoolAsyncCompletion *pool_async_create_completion(); | |
1533 | ||
1534 | // -- aio -- | |
1535 | static AioCompletion *aio_create_completion(); | |
1536 | static AioCompletion *aio_create_completion(void *cb_arg, callback_t cb_complete, | |
9f95a23c TL |
1537 | callback_t cb_safe) |
1538 | __attribute__ ((deprecated)); | |
1539 | static AioCompletion *aio_create_completion(void *cb_arg, callback_t cb_complete); | |
f67539c2 | 1540 | |
7c673cae FG |
1541 | friend std::ostream& operator<<(std::ostream &oss, const Rados& r); |
1542 | private: | |
f67539c2 TL |
1543 | friend class neorados::RADOS; |
1544 | ||
7c673cae FG |
1545 | // We don't allow assignment or copying |
1546 | Rados(const Rados& rhs); | |
1547 | const Rados& operator=(const Rados& rhs); | |
1548 | RadosClient *client; | |
1549 | }; | |
11fdf7f2 TL |
1550 | |
1551 | } // namespace v14_2_0 | |
1552 | } // namespace librados | |
7c673cae FG |
1553 | |
1554 | #endif | |
1555 |