]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
hobject_t: define max value
authorSage Weil <sage.weil@dreamhost.com>
Fri, 2 Dec 2011 04:56:50 +0000 (20:56 -0800)
committerSamuel Just <samuel.just@dreamhost.com>
Wed, 7 Dec 2011 19:40:10 +0000 (11:40 -0800)
Create a max value that is greater than all other values.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/object.h

index 6aebba76ced6b6154488e40e48fc33d4ba36f62a..4b044d6db1b3b53688152d5aaafff63c5f98e20c 100644 (file)
@@ -263,6 +263,7 @@ struct hobject_t {
   object_t oid;
   snapid_t snap;
   uint32_t hash;
+  bool max;
 
 private:
   string key;
@@ -271,16 +272,23 @@ public:
   const string &get_key() const {
     return key;
   }
-
-  hobject_t() : snap(0), hash(0) {}
-  hobject_t(object_t oid, const string &key, snapid_t snap, uint32_t hash) : 
-    oid(oid), snap(snap), hash(hash), 
+  
+  hobject_t() : snap(0), hash(0), max(false) {}
+  hobject_t(object_t oid, const string& key, snapid_t snap, uint64_t hash) : 
+    oid(oid), snap(snap), hash(hash), max(false),
     key(oid.name == key ? string() : key) {}
 
   hobject_t(const sobject_t &soid, const string &key, uint32_t hash) : 
-    oid(soid.oid), snap(soid.snap), hash(hash),
+    oid(soid.oid), snap(soid.snap), hash(hash), max(false),
     key(soid.oid.name == key ? string() : key) {}
 
+  // maximum sorted value.
+  static hobject_t get_max() {
+    hobject_t h;
+    h.max = true;
+    return h;
+  }
+
   /* Do not use when a particular hash function is needed */
   explicit hobject_t(const sobject_t &o) :
     oid(o.oid), snap(o.snap) {