]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: support op flags
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 10 Aug 2011 18:29:17 +0000 (11:29 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 10 Aug 2011 19:14:35 +0000 (12:14 -0700)
src/include/rados/librados.hpp
src/librados.cc

index 40573a1a63f0c13ddd6f6ba95230bdcf72a72c1a..0b634c19757c8cc157ba2b079b9e7de2238da88a 100644 (file)
@@ -103,6 +103,11 @@ namespace librados
     PoolAsyncCompletionImpl *pc;
   };
 
+  enum ObjectOperationFlags {
+    OP_EXCL =   1,
+    OP_FAILOK = 2,
+  };
+
   /*
    * ObjectOperation : compount object operation
    * Batch multiple object operations into a single request, to be applied
@@ -115,6 +120,7 @@ namespace librados
     virtual ~ObjectOperation();
 
     size_t size();
+    void set_op_flags(ObjectOperationFlags flags);
 
     void cmpxattr(const char *name, uint8_t op, const bufferlist& val);
     void cmpxattr(const char *name, uint8_t op, uint64_t v);
index b19a4f071816077bfd3dd62bbb51c33783ddf5b9..6986a21e101d590f7993e17d08e4e5d702ed9142 100644 (file)
@@ -138,6 +138,18 @@ size_t librados::ObjectOperation::size()
   return o->size();
 }
 
+void librados::ObjectOperation::set_op_flags(ObjectOperationFlags flags)
+{
+  int rados_flags = 0;
+  if (flags & OP_EXCL)
+    rados_flags |= CEPH_OSD_OP_FLAG_EXCL;
+  if (flags & OP_FAILOK)
+    rados_flags |= CEPH_OSD_OP_FLAG_FAILOK;
+
+  ::ObjectOperation *o = (::ObjectOperation *)impl;
+  o->set_last_op_flags(rados_flags);
+}
+
 void librados::ObjectOperation::cmpxattr(const char *name, uint8_t op, const bufferlist& v)
 {
   ::ObjectOperation *o = (::ObjectOperation *)impl;