]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: add CollectionHandle
authorSage Weil <sage@redhat.com>
Mon, 18 Jan 2016 14:36:02 +0000 (09:36 -0500)
committerSage Weil <sage@redhat.com>
Wed, 27 Jan 2016 19:34:50 +0000 (14:34 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/ObjectStore.h

index ba9dd76e97ae7b38c299cb3913e0a6496ce79dde..49065036addace1c09e6d2982918eb8c29388015 100644 (file)
@@ -206,6 +206,20 @@ public:
     }
   };
 
+  struct CollectionImpl : public RefCountedObject {
+    virtual const coll_t &get_cid() = 0;
+    CollectionImpl() : RefCountedObject(NULL, 0) {}
+  };
+  typedef boost::intrusive_ptr<CollectionImpl> CollectionHandle;
+
+  struct CompatCollectionHandle : public CollectionImpl {
+    coll_t cid;
+    CompatCollectionHandle(coll_t c) : cid(c) {}
+    const coll_t &get_cid() override {
+      return cid;
+    }
+  };
+
   /*********************************
    *
    * Object Contents and semantics
@@ -1875,10 +1889,21 @@ public:
    */
   virtual int get_ideal_list_max() { return 64; }
 
+
   /**
-   * Synchronous read operations
+   * get a collection handle
+   *
+   * Provide a trivial handle as a default to avoid converting legacy
+   * implementations.
    */
+  virtual CollectionHandle open_collection(const coll_t &cid) {
+    return new CompatCollectionHandle(cid);
+  }
+
 
+  /**
+   * Synchronous read operations
+   */
 
   /**
    * exists -- Test for existance of object