]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
objectstore: introduce touch operation
authorSage Weil <sage@newdream.net>
Wed, 12 Nov 2008 20:21:57 +0000 (12:21 -0800)
committerSage Weil <sage@newdream.net>
Wed, 12 Nov 2008 20:26:43 +0000 (12:26 -0800)
Create an object if it doesn't exist.

src/os/ObjectStore.h

index 01cde7fb65faebe4c0a2b89db184957f9a3f89f5..f266923779823721203eff071d2578d6f602c619 100644 (file)
@@ -77,6 +77,7 @@ public:
    */
   class Transaction {
   public:
+    static const int OP_TOUCH =        9;   // cid, oid
     static const int OP_WRITE =        10;  // cid, oid, offset, len, bl
     static const int OP_ZERO =         11;  // cid, oid, offset, len
     static const int OP_TRUNCATE =     12;  // cid, oid, len
@@ -154,6 +155,14 @@ public:
       ps = attrsets[attrsetp++];
     }
 
+    void touch(coll_t cid, pobject_t oid) {
+      int op = OP_WRITE;
+      ops.push_back(op);
+      cids.push_back(cid);
+      oids.push_back(oid);
+      len++;
+      blen += 3;
+    }
     void write(coll_t cid, pobject_t oid, __u64 off, size_t len, const bufferlist& bl) {
       int op = OP_WRITE;
       ops.push_back(op);