libmobject-store.h 22.1 KB
Newer Older
Shane Snyder's avatar
Shane Snyder committed
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */

#ifndef __MOBJECT_STORE
#define __MOBJECT_STORE

#ifdef __cplusplus
extern "C" {
#endif

14 15 16
#include <inttypes.h>
#include <time.h>

17
// derived from: http://docs.ceph.com/docs/master/mobject_store/api/libmobject_store/
Shane Snyder's avatar
Shane Snyder committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35


/* KEY TERMS
 * 
 * Pool:
 *      - an object container providing separate namespaces for objects
 *      - pools can have different placement & replication strategies
 *
 * Placement group (PG):
 *      - Groups of objects within a pool that share the same OSDs.
 *
 * CRUSH:
 *      - Data placement algorithm for RADOS objects, mapping OIDs to PGs.
 */

/* ASSUMPTIONS/QUESTIONS
 * - Initially we enforce one global pool for each mobject store instance for simplicity.
 *
Shane Snyder's avatar
Shane Snyder committed
36 37
 * - Does ch-placement offer an algorithm similar to crush (e.g., PG concept)? 
 *
Shane Snyder's avatar
Shane Snyder committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51
 * - We will not implement any replication.
 *
 * - RADOS seems to expose object versions, but I only see them in the 'object operation' portion of their API, which is big and awkward (i.e., would love to not implement that). 
 *
 * - Do we need any of the following from RADOS:
 *      - async I/O operations?
 *      - cursor stuff?
 *      - snapshots?
 *      - extended attributes?
 * 
 * - RADOS API includes a watch/notify API that sounds like something we could build on top of a generic SSG pub-sub service, if we wanted.
 *
 */

52
/* opaque type for a handle for interacting with a mobject store cluster */
53
typedef void *mobject_store_t;
Shane Snyder's avatar
Shane Snyder committed
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
/**
 * @name Operation Flags
 * Flags for mobject_store_read_op_operate(), mobject_store_write_op_operate(),
 * mobject_store_aio_read_op_operate(), and mobject_store_aio_write_op_operate().
 * See libmobject_store.hpp for details.
 * @{
 */
enum {
  LIBMOBJECT_OPERATION_NOFLAG             = 0,
  LIBMOBJECT_OPERATION_BALANCE_READS      = 1,
  LIBMOBJECT_OPERATION_LOCALIZE_READS     = 2,
  LIBMOBJECT_OPERATION_ORDER_READS_WRITES = 4,
  LIBMOBJECT_OPERATION_IGNORE_CACHE       = 8,
  LIBMOBJECT_OPERATION_SKIPRWLOCKS        = 16,
  LIBMOBJECT_OPERATION_IGNORE_OVERLAY     = 32,
  /* send requests to cluster despite the cluster or pool being marked
     full; ops will either succeed (e.g., delete) or return EDQUOT or
     ENOSPC. */
  LIBMOBJECT_OPERATION_FULL_TRY           = 64,
  /*
   * Mainly for delete op
   */
  LIBMOBJECT_OPERATION_FULL_FORCE		= 128,
  LIBMOBJECT_OPERATION_IGNORE_REDIRECT	= 256,
};
/** @} */

/**
 * @typedef mobject_store_ioctx_t
 *
 * An io context encapsulates a few settings for all I/O operations
 * done on it:
 * - pool - set when the io context is created (see mobject_store_ioctx_create())
 * - snapshot context for writes (see
 *   mobject_store_ioctx_selfmanaged_snap_set_write_ctx())
 * - snapshot id to read from (see mobject_store_ioctx_snap_set_read())
 * - object locator for all single-object operations (see
 *   mobject_store_ioctx_locator_set_key())
 * - namespace for all single-object operations (see
 *   mobject_store_ioctx_set_namespace()).  Set to LIBMOBJECT_ALL_NSPACES
 *   before mobject_store_nobjects_list_open() will list all objects in all
 *   namespaces.
 *
 * @warning Changing any of these settings is not thread-safe -
 * libmobject_store users must synchronize any of these changes on their own,
 * or use separate io contexts for each thread
 */
typedef void *mobject_store_ioctx_t;

/**
 * @typedef mobject_store_omap_iter_t
 * An iterator for listing omap key/value pairs on an object.
 * Used with mobject_store_read_op_omap_get_keys(), mobject_store_read_op_omap_get_vals(),
 * mobject_store_read_op_omap_get_vals_by_keys(), mobject_store_omap_get_next(), and
 * mobject_store_omap_get_end().
 */
typedef void *mobject_store_omap_iter_t;

/**
 * @typedef mobject_store_write_op_t
 *
 * An object write operation stores a number of operations which can be
 * executed atomically. For usage, see:
 * - Creation and deletion: mobject_store_create_write_op() mobject_store_release_write_op()
 * - Extended attribute manipulation: mobject_store_write_op_cmpxattr()
 *   mobject_store_write_op_cmpxattr(), mobject_store_write_op_setxattr(),
 *   mobject_store_write_op_rmxattr()
 * - Object map key/value pairs: mobject_store_write_op_omap_set(),
 *   mobject_store_write_op_omap_rm_keys(), mobject_store_write_op_omap_clear(),
 *   mobject_store_write_op_omap_cmp()
 * - Object properties: mobject_store_write_op_assert_exists(),
 *   mobject_store_write_op_assert_version()
 * - Creating objects: mobject_store_write_op_create()
 * - IO on objects: mobject_store_write_op_append(), mobject_store_write_op_write(), mobject_store_write_op_zero
 *   mobject_store_write_op_write_full(), mobject_store_write_op_writesame(), mobject_store_write_op_remove,
 *   mobject_store_write_op_truncate(), mobject_store_write_op_zero(), mobject_store_write_op_cmpext()
 * - Hints: mobject_store_write_op_set_alloc_hint()
 * - Performing the operation: mobject_store_write_op_operate(), mobject_store_aio_write_op_operate()
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
134 135 136
typedef struct mobject_store_write_op *mobject_store_write_op_t;

#define MOBJECT_WRITE_OP_NULL ((mobject_store_write_op_t)0)
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157

/**
 * @typedef mobject_store_read_op_t
 *
 * An object read operation stores a number of operations which can be
 * executed atomically. For usage, see:
 * - Creation and deletion: mobject_store_create_read_op() mobject_store_release_read_op()
 * - Extended attribute manipulation: mobject_store_read_op_cmpxattr(),
 *   mobject_store_read_op_getxattr(), mobject_store_read_op_getxattrs()
 * - Object map key/value pairs: mobject_store_read_op_omap_get_vals(),
 *   mobject_store_read_op_omap_get_keys(), mobject_store_read_op_omap_get_vals_by_keys(),
 *   mobject_store_read_op_omap_cmp()
 * - Object properties: mobject_store_read_op_stat(), mobject_store_read_op_assert_exists(),
 *   mobject_store_read_op_assert_version()
 * - IO on objects: mobject_store_read_op_read(), mobject_store_read_op_checksum(),
 *   mobject_store_read_op_cmpext()
 * - Custom operations: mobject_store_read_op_exec(), mobject_store_read_op_exec_user_buf()
 * - Request properties: mobject_store_read_op_set_flags()
 * - Performing the operation: mobject_store_read_op_operate(),
 *   mobject_store_aio_read_op_operate()
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
158 159
typedef struct mobject_store_read_op *mobject_store_read_op_t;

160
#define MOBJECT_READ_OP_NULL ((mobject_store_read_op_t)0)
161

162 163 164 165 166 167
/**
 * @typedef mobject_store_completion_t
 * Represents the state of an asynchronous operation - it contains the
 * return value once the operation completes, and can be used to block
 * until the operation is complete or safe.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
168 169 170
typedef struct mobject_store_completion* mobject_store_completion_t;

#define MOBJECT_COMPLETION_NULL ((mobject_store_completion_t)0)
Shane Snyder's avatar
Shane Snyder committed
171 172 173 174 175 176 177 178 179

/*****************************************
 * mobject store setup/teardown routines *
 *****************************************/

/**
 * Create a handle to a mobject cluster.
 *
 * @param[in/out] cluster   pointer to store mobject cluster handle at
180
 * @param[in]          id   the user to connect as (NOTE: ignored in mobject store)
Shane Snyder's avatar
Shane Snyder committed
181 182 183
 * @returns 0 on success, negative error code on failure
 *
 * NOTES:
184
 *      - from mobject_store_create(mobject_store_t * cluster, const char *const user_id)
Shane Snyder's avatar
Shane Snyder committed
185 186 187
 *          - drop user_id from API
 *      - may eventually need conf. file, env variable checking, etc.
 */
188 189
int mobject_store_create(
    mobject_store_t *cluster,
190
    const char * const id);
Shane Snyder's avatar
Shane Snyder committed
191 192 193 194 195 196 197

/**
 * Connect to a mobject cluster.
 *
 * @param[in] cluster   handle to mobject cluster
 * @returns 0 on success, negative error code on failure
 */
198
int mobject_store_connect(mobject_store_t cluster);
Shane Snyder's avatar
Shane Snyder committed
199 200 201 202 203 204

/**
 * Disconnects from a mobject cluster and destroys the cluster handle.
 * 
 * @param[in] cluster   handle to mobject cluster
 */
205
void mobject_store_shutdown(mobject_store_t cluster);
Shane Snyder's avatar
Shane Snyder committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231

/*****************************************************
 * mobject store i/o context setup/teardown routines *
 *****************************************************/

/**
 * Create an I/O context for a mobject cluster.
 *
 * @param[in] cluster       handle to mobject cluster
 * @param[in] pool_name     name of the pool
 * @param[in/out] ioctx     pointer to store the io context at
 * @returns 0 on success, negative error code on failure
 *
 * NOTES:
 *      - only one global pool exists and is defined at the top of this header
 */
int mobject_store_ioctx_create(
    mobject_store_t cluster,
    const char * pool_name,
    mobject_store_ioctx_t *ioctx);

/**
 * Destroy an I/O context.
 *
 * @param[in] ioctx     io context to destroy
 */
232
void mobject_store_ioctx_destroy(mobject_store_ioctx_t ioctx);
Shane Snyder's avatar
Shane Snyder committed
233 234 235 236 237 238

/******************************
 * mobject store i/o routines *
 ******************************/

/**
239 240 241
 * Create a new mobject_store_write_op_t write operation. This will store all actions
 * to be performed atomically. You must call mobject_store_release_write_op when you are
 * finished with it.
Shane Snyder's avatar
Shane Snyder committed
242
 *
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
 * @returns non-NULL on success, NULL on memory allocation error.
 */
mobject_store_write_op_t mobject_store_create_write_op(void);

/**
 * Free a mobject_store_write_op_t, must be called when you're done with it.
 * @param write_op operation to deallocate, created with mobject_store_create_write_op
 */
void mobject_store_release_write_op(mobject_store_write_op_t write_op);

/**
 * Create the object
 * @param write_op operation to add this action to
 * @param exclusive set to either LIBMOBJECT_CREATE_EXCLUSIVE or
   LIBMOBJECT_CREATE_IDEMPOTENT
 * will error if the object already exists.
 * @param category category string (DEPRECATED, HAS NO EFFECT)
 */
void mobject_store_write_op_create(mobject_store_write_op_t write_op,
                                   int exclusive,
                                   const char* category);

/**
 * Write to offset
 * @param write_op operation to add this action to
 * @param offset offset to write to
 * @param buffer bytes to write
 * @param len length of buffer
 */
void mobject_store_write_op_write(mobject_store_write_op_t write_op,
                                  const char *buffer,
                                  size_t len,
                                  uint64_t offset);

/**
 * Write whole object, atomically replacing it.
 * @param write_op operation to add this action to
 * @param buffer bytes to write
 * @param len length of buffer
 */
void mobject_store_write_op_write_full(mobject_store_write_op_t write_op,
                                       const char *buffer,
                                       size_t len);

/**
 * Write the same buffer multiple times
 * @param write_op operation to add this action to
 * @param buffer bytes to write
 * @param data_len length of buffer
 * @param write_len total number of bytes to write, as a multiple of @data_len
 * @param offset offset to write to
 */
void mobject_store_write_op_writesame(mobject_store_write_op_t write_op,
                                      const char *buffer,
									  size_t data_len,
									  size_t write_len,
									  uint64_t offset);

/**
 * Append to end of object.
 * @param write_op operation to add this action to
 * @param buffer bytes to write
 * @param len length of buffer
 */
void mobject_store_write_op_append(mobject_store_write_op_t write_op,
		                           const char *buffer,
								   size_t len);
/**
 * Remove object
 * @param write_op operation to add this action to
 */
void mobject_store_write_op_remove(mobject_store_write_op_t write_op);

/**
 * Truncate an object
 * @param write_op operation to add this action to
 * @param offset Offset to truncate to
Shane Snyder's avatar
Shane Snyder committed
320
 */
321 322
void mobject_store_write_op_truncate(mobject_store_write_op_t write_op,
                                     uint64_t offset);
Shane Snyder's avatar
Shane Snyder committed
323 324

/**
325 326 327 328 329 330 331 332 333 334 335
 * Zero part of an object
 * @param write_op operation to add this action to
 * @param offset Offset to zero
 * @param len length to zero
 */
void mobject_store_write_op_zero(mobject_store_write_op_t write_op,
                                 uint64_t offset,
                                 uint64_t len);

/**
 * Set key/value pairs on an object
Shane Snyder's avatar
Shane Snyder committed
336
 *
337 338 339 340 341
 * @param write_op operation to add this action to
 * @param keys array of null-terminated char arrays representing keys to set
 * @param vals array of pointers to values to set
 * @param lens array of lengths corresponding to each value
 * @param num number of key/value pairs to set
Shane Snyder's avatar
Shane Snyder committed
342
 */
343 344 345 346 347
void mobject_store_write_op_omap_set(mobject_store_write_op_t write_op,
                                     char const* const* keys,
                                     char const* const* vals,
                                     const size_t *lens,
                                     size_t num);
Shane Snyder's avatar
Shane Snyder committed
348 349

/**
350
 * Remove key/value pairs from an object
Shane Snyder's avatar
Shane Snyder committed
351
 *
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
 * @param write_op operation to add this action to
 * @param keys array of null-terminated char arrays representing keys to remove
 * @param keys_len number of key/value pairs to remove
 */
void mobject_store_write_op_omap_rm_keys(mobject_store_write_op_t write_op,
                                         char const* const* keys,
                                         size_t keys_len);

/**
 * Perform a write operation synchronously
 * @param write_op operation to perform
 * @param io the ioctx that the object is in
 * @param oid the object id
 * @param mtime the time to set the mtime to, NULL for the current time
 * @param flags flags to apply to the entire operation (LIBMOBJECT_OPERATION_*)
Shane Snyder's avatar
Shane Snyder committed
367
 */
368 369 370 371 372
int mobject_store_write_op_operate(mobject_store_write_op_t write_op,
                                   mobject_store_ioctx_t io,
								   const char *oid,
								   time_t *mtime,
								   int flags);
Shane Snyder's avatar
Shane Snyder committed
373 374

/**
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
 * Perform a write operation asynchronously
 * @param write_op operation to perform
 * @param io the ioctx that the object is in
 * @param completion what to do when operation has been attempted
 * @param oid the object id
 * @param mtime the time to set the mtime to, NULL for the current time
 * @param flags flags to apply to the entire operation (LIBMOBJECT_OPERATION_*)
 */
int mobject_store_aio_write_op_operate(mobject_store_write_op_t write_op,
                                       mobject_store_ioctx_t io,
                                       mobject_store_completion_t completion,
                                       const char *oid,
                                       time_t *mtime,
                                       int flags);

/**
 * Create a new mobject_store_read_op_t write operation. This will store all
 * actions to be performed atomically. You must call
 * mobject_store_release_read_op when you are finished with it (after it
 * completes, or you decide not to send it in the first place).
Shane Snyder's avatar
Shane Snyder committed
395
 *
396 397 398 399 400 401 402
 * @returns non-NULL on success, NULL on memory allocation error.
 */
mobject_store_read_op_t mobject_store_create_read_op(void);

/**
 * Free a mobject_store_read_op_t, must be called when you're done with it.
 * @param read_op operation to deallocate, created with mobject_store_create_read_op
Shane Snyder's avatar
Shane Snyder committed
403
 */
404
void mobject_store_release_read_op(mobject_store_read_op_t read_op);
Shane Snyder's avatar
Shane Snyder committed
405 406

/**
407 408 409 410 411 412 413 414 415 416 417 418 419
 * Get object size and mtime
 * @param read_op operation to add this action to
 * @param psize where to store object size
 * @param pmtime where to store modification time
 * @param prval where to store the return value of this action
 */
void mobject_store_read_op_stat(mobject_store_read_op_t read_op,
                                uint64_t *psize,
                                time_t *pmtime,
                                int *prval);

/**
 * Read bytes from offset into buffer.
Shane Snyder's avatar
Shane Snyder committed
420
 *
421 422 423 424 425 426 427 428 429 430
 * prlen will be filled with the number of bytes read if successful.
 * A short read can only occur if the read reaches the end of the
 * object.
 *
 * @param read_op operation to add this action to
 * @param offset offset to read from
 * @param len length of buffer
 * @param buffer where to put the data
 * @param bytes_read where to store the number of bytes read by this action
 * @param prval where to store the return value of this action
Shane Snyder's avatar
Shane Snyder committed
431
 */
432 433 434 435 436 437
void mobject_store_read_op_read(mobject_store_read_op_t read_op,
                                uint64_t offset,
                                size_t len,
                                char *buffer,
                                size_t *bytes_read,
                                int *prval);
Shane Snyder's avatar
Shane Snyder committed
438 439

/**
440
 * Start iterating over key/value pairs on an object.
Shane Snyder's avatar
Shane Snyder committed
441
 *
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
 * They will be returned sorted by key.
 *
 * @param read_op operation to add this action to
 * @param start_after list keys starting after start_after
 * @param filter_prefix list only keys beginning with filter_prefix
 * @param max_return list no more than max_return key/value pairs
 * @param iter where to store the iterator
 * @param prval where to store the return value from this action
 */
void mobject_store_read_op_omap_get_vals(mobject_store_read_op_t read_op,
                                         const char *start_after,
                                         const char *filter_prefix,
                                         uint64_t max_return,
                                         mobject_store_omap_iter_t *iter,
                                         int *prval);

/**
 * Start iterating over specific key/value pairs
 *
 * They will be returned sorted by key.
 *
 * @param read_op operation to add this action to
 * @param keys array of pointers to null-terminated keys to get
 * @param keys_len the number of strings in keys
 * @param iter where to store the iterator
 * @param prval where to store the return value from this action
 */
void mobject_store_read_op_omap_get_vals_by_keys(mobject_store_read_op_t read_op,
                                                 char const* const* keys,
                                                 size_t keys_len,
                                                 mobject_store_omap_iter_t *iter,
                                                 int *prval);

/**
 * Perform a read operation synchronously
 * @param read_op operation to perform
 * @param io the ioctx that the object is in
 * @param oid the object id
 * @param flags flags to apply to the entire operation (LIBMOBJECT_OPERATION_*)
Shane Snyder's avatar
Shane Snyder committed
481
 */
482 483 484 485
int mobject_store_read_op_operate(mobject_store_read_op_t read_op,
                                  mobject_store_ioctx_t io,
                                  const char *oid,
                                  int flags);
Shane Snyder's avatar
Shane Snyder committed
486 487

/**
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
 * Perform a read operation asynchronously
 * @param read_op operation to perform
 * @param io the ioctx that the object is in
 * @param completion what to do when operation has been attempted
 * @param oid the object id
 * @param flags flags to apply to the entire operation (LIBMOBJECT_OPERATION_*)
 */
int mobject_store_aio_read_op_operate(mobject_store_read_op_t read_op,
                                      mobject_store_ioctx_t io,
                                      mobject_store_completion_t completion,
                                      const char *oid,
                                      int flags);

/**
 * Get the next omap key/value pair on the object
 *
 * @pre iter is a valid iterator
Shane Snyder's avatar
Shane Snyder committed
505
 *
506 507 508 509 510 511 512 513 514 515
 * @post key and val are the next key/value pair. key is
 * null-terminated, and val has length len. If the end of the list has
 * been reached, key and val are NULL, and len is 0. key and val will
 * not be accessible after mobject_store_omap_get_end() is called on iter, so
 * if they are needed after that they should be copied.
 *
 * @param iter iterator to advance
 * @param key where to store the key of the next omap entry
 * @param val where to store the value of the next omap entry
 * @param len where to store the number of bytes in val
Shane Snyder's avatar
Shane Snyder committed
516 517
 * @returns 0 on success, negative error code on failure
 */
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
int mobject_store_omap_get_next(mobject_store_omap_iter_t iter,
                                char **key,
                                char **val,
                                size_t *len);

/**
 * Close the omap iterator.
 *
 * iter should not be used after this is called.
 *
 * @param iter the iterator to close
 */
void mobject_store_omap_get_end(mobject_store_omap_iter_t iter);

/**
 * @typedef mobject_store_callback_t
 * Callbacks for asynchrous operations take two parameters:
 * - cb the completion that has finished
 * - arg application defined data made available to the callback function
 */
typedef void (*mobject_store_callback_t)(mobject_store_completion_t cb, void *arg);

/**
 * Constructs a completion to use with asynchronous operations
 *
 * The complete and safe callbacks correspond to operations being
 * acked and committed, respectively. The callbacks are called in
 * order of receipt, so the safe callback may be triggered before the
 * complete callback, and vice versa. This is affected by journalling
 * on the OSDs.
 *
 * @note Read operations only get a complete callback.
 * @note BUG: this should check for ENOMEM instead of throwing an exception
 *
 * @param cb_arg application-defined data passed to the callback functions
 * @param cb_complete the function to be called when the operation is
 * in memory on all relpicas
 * @param cb_safe the function to be called when the operation is on
 * stable storage on all replicas
 * @param pc where to store the completion
 * @returns 0
 */
int mobject_store_aio_create_completion(void *cb_arg,
                                mobject_store_callback_t cb_complete,
                                mobject_store_callback_t cb_safe,
                                mobject_store_completion_t *pc);

/**
 * Block until an operation completes
 *
 * This means it is in memory on all replicas.
 *
 * @note BUG: this should be void
 *
 * @param c operation to wait for
 * @returns 0
 */
int mobject_store_aio_wait_for_complete(mobject_store_completion_t c);

/**
 * Has an asynchronous operation completed?
 *
 * @warning This does not imply that the complete callback has
 * finished
 *
 * @param c async operation to inspect
 * @returns whether c is complete
 */
int mobject_store_aio_is_complete(mobject_store_completion_t c);
587

588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
/**
 * Get the return value of an asychronous operation
 *
 * The return value is set when the operation is complete or safe,
 * whichever comes first.
 *
 * @pre The operation is safe or complete
 *
 * @param c async operation to inspect
 * @returns return value of the operation
 */
int mobject_store_aio_get_return_value(mobject_store_completion_t c);

/**
 * Release a completion
 *
 * Call this when you no longer need the completion. It may not be
 * freed immediately if the operation is not acked and committed.
 *
 * @param c completion to release
 */
void mobject_store_aio_release(mobject_store_completion_t c);

Shane Snyder's avatar
Shane Snyder committed
611 612 613 614 615
#ifdef __cplusplus
}
#endif

#endif /* __MOBJECT_STORE */