PoolAsyncCompletionImpl *pc;
};
+ /**
+ * These are per-op flags which may be different among
+ * ops added to an ObjectOperation.
+ */
enum ObjectOperationFlags {
OP_EXCL = 1,
OP_FAILOK = 2,
};
+ /**
+ * These flags apply to the ObjectOperation as a whole.
+ *
+ * BALANCE_READS and LOCALIZE_READS should only be used
+ * when reading from data you're certain won't change,
+ * like a snapshot, or where eventual consistency is ok.
+ */
+ enum ObjectOperationGlobalFlags {
+ OPERATION_NOFLAG = 0,
+ OPERATION_BALANCE_READS = 1,
+ OPERATION_LOCALIZE_READS = 2,
+ };
+
/*
* ObjectOperation : compound object operation
* Batch multiple object operations into a single request, to be applied
int aio_operate(const std::string& oid, AioCompletion *c,
ObjectWriteOperation *op, snap_t seq,
std::vector<snap_t>& snaps);
- int aio_operate(const std::string& oid, AioCompletion *c, ObjectReadOperation *op,
+ int aio_operate(const std::string& oid, AioCompletion *c,
+ ObjectReadOperation *op, bufferlist *pbl);
+ int aio_operate(const std::string& oid, AioCompletion *c,
+ ObjectReadOperation *op, snap_t snapid, int flags,
bufferlist *pbl);
// watch/notify
int librados::IoCtxImpl::aio_operate_read(const object_t &oid,
::ObjectOperation *o,
- AioCompletionImpl *c, bufferlist *pbl)
+ AioCompletionImpl *c,
+ int flags,
+ bufferlist *pbl)
{
Context *onack = new C_aio_Ack(c);
Mutex::Locker l(*lock);
objecter->read(oid, oloc,
- *o, snap_seq, pbl, 0,
+ *o, snap_seq, pbl, flags,
onack, &c->objver);
return 0;
}
int operate_read(const object_t& oid, ::ObjectOperation *o, bufferlist *pbl);
int aio_operate(const object_t& oid, ::ObjectOperation *o,
AioCompletionImpl *c, const SnapContext& snap_context);
- int aio_operate_read(const object_t& oid, ::ObjectOperation *o, AioCompletionImpl *c, bufferlist *pbl);
+ int aio_operate_read(const object_t& oid, ::ObjectOperation *o,
+ AioCompletionImpl *c, int flags, bufferlist *pbl);
struct C_aio_Ack : public Context {
librados::AioCompletionImpl *c;
snapc);
}
-int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, librados::ObjectReadOperation *o, bufferlist *pbl)
+int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
+ librados::ObjectReadOperation *o,
+ bufferlist *pbl)
+{
+ object_t obj(oid);
+ return io_ctx_impl->aio_operate_read(obj, (::ObjectOperation*)o->impl, c->pc,
+ 0, pbl);
+}
+
+int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
+ librados::ObjectReadOperation *o,
+ snap_t snapid, int flags, bufferlist *pbl)
{
object_t obj(oid);
- return io_ctx_impl->aio_operate_read(obj, (::ObjectOperation*)o->impl, c->pc, pbl);
+ int op_flags = 0;
+ if (flags & OPERATION_BALANCE_READS)
+ op_flags |= CEPH_OSD_FLAG_BALANCE_READS;
+ if (flags & OPERATION_LOCALIZE_READS)
+ op_flags |= CEPH_OSD_FLAG_LOCALIZE_READS;
+
+ return io_ctx_impl->aio_operate_read(obj, (::ObjectOperation*)o->impl, c->pc,
+ op_flags, pbl);
}
void librados::IoCtx::snap_set_read(snap_t seq)