/** @endcond */
/** @} */
+/**
+ * @defgroup librados_h_operation_flags
+ * Flags for rados_read_op_opeprate(), rados_write_op_operate(),
+ * rados_aio_read_op_operate(), and rados_aio_write_op_operate().
+ * See librados.hpp for details.
+ * @{
+ */
+/** @cond TODO_enums_not_yet_in_asphyxiate */
+enum {
+ LIBRADOS_OPERATION_NOFLAG = 0,
+ LIBRADOS_OPERATION_BALANCE_READS = 1,
+ LIBRADOS_OPERATION_LOCALIZE_READS = 2,
+ LIBRADOS_OPERATION_ORDER_READS_WRITES = 4,
+ LIBRADOS_OPERATION_IGNORE_CACHE = 8,
+ LIBRADOS_OPERATION_SKIPRWLOCKS = 16,
+ LIBRADOS_OPERATION_IGNORE_OVERLAY = 32,
+};
+/** @endcond */
+/** @} */
+
/*
* snap id contants
*/
* @io the ioctx that the object is in
* @oid the object id
* @mtime the time to set the mtime to, NULL for the current time
+ * @flags flags to apply to the entire operation (LIBRADOS_OPERATION_*)
*/
int rados_write_op_operate(rados_write_op_t write_op,
- rados_ioctx_t io,
- const char *oid,
- time_t *mtime);
+ rados_ioctx_t io,
+ const char *oid,
+ time_t *mtime,
+ int flags);
/**
* Perform a write operation asynchronously
* @param write_op operation to perform
* @param completion what to do when operation has been attempted
* @oid the object id
* @mtime the time to set the mtime to, NULL for the current time
+ * @flags flags to apply to the entire operation (LIBRADOS_OPERATION_*)
*/
int rados_aio_write_op_operate(rados_write_op_t write_op,
rados_ioctx_t io,
rados_completion_t completion,
const char *oid,
- time_t *mtime);
+ time_t *mtime,
+ int flags);
/** @} Object Operations */
extern "C" int rados_write_op_operate(rados_write_op_t write_op,
rados_ioctx_t io,
const char *oid,
- time_t *mtime)
+ time_t *mtime,
+ int flags)
{
object_t obj(oid);
::ObjectOperation *oo = (::ObjectOperation *) write_op;
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
- return ctx->operate(obj, oo, mtime);
+ return ctx->operate(obj, oo, mtime, flags);
}
extern "C" int rados_aio_write_op_operate(rados_write_op_t write_op,
- rados_ioctx_t io,
- rados_completion_t completion,
- const char *oid,
- time_t *mtime)
+ rados_ioctx_t io,
+ rados_completion_t completion,
+ const char *oid,
+ time_t *mtime,
+ int flags)
{
object_t obj(oid);
::ObjectOperation *oo = (::ObjectOperation *) write_op;
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
librados::AioCompletionImpl *c = (librados::AioCompletionImpl*)completion;
- return ctx->aio_operate(obj, oo, c, ctx->snapc, 0);
+ return ctx->aio_operate(obj, oo, c, ctx->snapc, flags);
+}
}
rados_write_op_assert_exists(op);
// -2, ENOENT
- ASSERT_EQ(-2, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(-2, rados_write_op_operate(op, ioctx, "test", NULL, 0));
rados_release_write_op(op);
rados_write_op_t op2 = rados_create_write_op();
rados_completion_t completion;
ASSERT_EQ(0, rados_aio_create_completion(NULL, NULL, NULL, &completion));
- ASSERT_EQ(0, rados_aio_write_op_operate(op2, ioctx, completion, "test", NULL));
+ ASSERT_EQ(0, rados_aio_write_op_operate(op2, ioctx, completion, "test", NULL, 0));
rados_aio_wait_for_complete(completion);
ASSERT_EQ(-2, rados_aio_get_return_value(completion));
ASSERT_TRUE(op);
rados_write_op_create(op, LIBRADOS_CREATE_EXCLUSIVE, NULL);
rados_write_op_setxattr(op, "key", "value", 5);
- ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0));
rados_release_write_op(op);
// Check that xattr exists, if it does, delete it.
rados_write_op_create(op, LIBRADOS_CREATE_IDEMPOTENT, NULL);
rados_write_op_cmpxattr(op, "key", LIBRADOS_CMPXATTR_OP_EQ, "value", 5);
rados_write_op_rmxattr(op, "key");
- ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0));
rados_release_write_op(op);
// Check the xattr exits, if it does, add it again (will fail) with -125
ASSERT_TRUE(op);
rados_write_op_cmpxattr(op, "key", LIBRADOS_CMPXATTR_OP_EQ, "value", 5);
rados_write_op_setxattr(op, "key", "value", 5);
- ASSERT_EQ(-125, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(-125, rados_write_op_operate(op, ioctx, "test", NULL, 0));
rados_release_write_op(op);
ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster));
rados_write_op_create(op, LIBRADOS_CREATE_EXCLUSIVE, NULL);
rados_write_op_write(op, "four", 4, 0);
rados_write_op_write_full(op, "hi", 2);
- ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0));
char hi[4];
ASSERT_EQ(2, rados_read(ioctx, "test", hi, 4, 0));
rados_release_write_op(op);
ASSERT_TRUE(op);
rados_write_op_truncate(op, 1);
rados_write_op_append(op, "hi", 2);
- ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0));
ASSERT_EQ(3, rados_read(ioctx, "test", hi, 4, 0));
rados_release_write_op(op);
ASSERT_TRUE(op);
rados_write_op_zero(op, 0, 3);
rados_write_op_remove(op);
- ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL));
+ ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0));
// ENOENT
ASSERT_EQ(-2, rados_read(ioctx, "test", hi, 4, 0));
rados_release_write_op(op);