]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd_types.h: Add constructors for ObjectRecovery*
authorSamuel Just <samuel.just@dreamhost.com>
Tue, 14 Feb 2012 20:52:59 +0000 (12:52 -0800)
committerSamuel Just <samuel.just@dreamhost.com>
Tue, 14 Feb 2012 20:52:59 +0000 (12:52 -0800)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/osd/osd_types.h

index a019394a89fe0100fb871921c99ab5122235516b..d7bcb6432ee583600a77f0c2dfc556a1cb198eaf 100644 (file)
@@ -1612,24 +1612,9 @@ WRITE_CLASS_ENCODER(object_info_t)
 
 ostream& operator<<(ostream& out, const object_info_t& oi);
 
-// Object recovery
-struct ObjectRecoveryProgress {
-  bool first;
-  uint64_t data_recovered_to;
-  bool data_complete;
-  string omap_recovered_to;
-  bool omap_complete;
-
-  static void generate_test_instances(list<ObjectRecoveryProgress*>& o);
-  void encode(bufferlist &bl) const;
-  void decode(bufferlist::iterator &bl);
-  ostream &print(ostream &out) const;
-  void dump(Formatter *f) const;
-};
-WRITE_CLASS_ENCODER(ObjectRecoveryProgress)
-ostream& operator<<(ostream& out, const ObjectRecoveryProgress &prog);
 
 
+// Object recovery
 struct ObjectRecoveryInfo {
   hobject_t soid;
   eversion_t version;
@@ -1639,6 +1624,8 @@ struct ObjectRecoveryInfo {
   interval_set<uint64_t> copy_subset;
   map<hobject_t, interval_set<uint64_t> > clone_subset;
 
+  ObjectRecoveryInfo() : size(0) { }
+
   static void generate_test_instances(list<ObjectRecoveryInfo*>& o);
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator &bl);
@@ -1648,6 +1635,32 @@ struct ObjectRecoveryInfo {
 WRITE_CLASS_ENCODER(ObjectRecoveryInfo)
 ostream& operator<<(ostream& out, const ObjectRecoveryInfo &inf);
 
+struct ObjectRecoveryProgress {
+  bool first;
+  uint64_t data_recovered_to;
+  bool data_complete;
+  string omap_recovered_to;
+  bool omap_complete;
+
+  ObjectRecoveryProgress()
+    : first(true),
+      data_recovered_to(0),
+      data_complete(false), omap_complete(false) { }
+
+  bool is_complete(const ObjectRecoveryInfo& info) const {
+    return data_recovered_to >= (info.copy_subset.empty() ? 0 : info.copy_subset.range_end());
+  }
+
+  static void generate_test_instances(list<ObjectRecoveryProgress*>& o);
+  void encode(bufferlist &bl) const;
+  void decode(bufferlist::iterator &bl);
+  ostream &print(ostream &out) const;
+  void dump(Formatter *f) const;
+};
+WRITE_CLASS_ENCODER(ObjectRecoveryProgress)
+ostream& operator<<(ostream& out, const ObjectRecoveryProgress &prog);
+
+
 /*
  * summarize pg contents for purposes of a scrub
  */