]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-dencoder: generate test instances on heap
authorSage Weil <sage.weil@dreamhost.com>
Wed, 1 Feb 2012 19:25:30 +0000 (11:25 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 1 Feb 2012 19:25:30 +0000 (11:25 -0800)
Some objects aren't copyable (OSDMap contains CrushWrapper), but we'd
still like to programmatically generate test instances.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/msg/msg_types.cc
src/msg/msg_types.h
src/os/ObjectStore.cc
src/os/ObjectStore.h
src/osd/OSDMap.cc
src/osd/OSDMap.h
src/osd/PG.h
src/osd/osd_types.cc
src/osd/osd_types.h
src/test/encoding/ceph_dencoder.cc
src/test/encoding/types.h

index e6ef3ecf406ac70f9d8c5b9e06ed801731186c60..676adbab9c27fa3a67efdcccf7ad2f8f58649a73 100644 (file)
@@ -20,27 +20,29 @@ void entity_addr_t::dump(Formatter *f) const
   f->dump_stream("addr") << addr;
 }
 
-void entity_name_t::generate_test_instances(list<entity_name_t>& o)
+void entity_name_t::generate_test_instances(list<entity_name_t*>& o)
 {
-  o.push_back(entity_name_t::MON());
-  o.push_back(entity_name_t::MON(1));
-  o.push_back(entity_name_t::OSD(1));
-  o.push_back(entity_name_t::CLIENT(1));
+  o.push_back(new entity_name_t(entity_name_t::MON()));
+  o.push_back(new entity_name_t(entity_name_t::MON(1)));
+  o.push_back(new entity_name_t(entity_name_t::OSD(1)));
+  o.push_back(new entity_name_t(entity_name_t::CLIENT(1)));
 }
 
-void entity_addr_t::generate_test_instances(list<entity_addr_t>& o)
+void entity_addr_t::generate_test_instances(list<entity_addr_t*>& o)
 {
-  o.push_back(entity_addr_t());
-  entity_addr_t a;
-  a.set_nonce(1);
-  o.push_back(a);
-  a.set_family(AF_INET);
-  a.set_in4_quad(0, 127);
-  a.set_in4_quad(0, 0);
-  a.set_in4_quad(0, 1);
-  a.set_in4_quad(0, 2);
-  a.set_port(2);
+  o.push_back(new entity_addr_t());
+  entity_addr_t *a = new entity_addr_t();
+  a->set_nonce(1);
   o.push_back(a);
+  entity_addr_t *b = new entity_addr_t();
+  b->set_nonce(5);
+  b->set_family(AF_INET);
+  b->set_in4_quad(0, 127);
+  b->set_in4_quad(0, 0);
+  b->set_in4_quad(0, 1);
+  b->set_in4_quad(0, 2);
+  b->set_port(2);
+  o.push_back(b);
 }
 
 bool entity_addr_t::parse(const char *s, const char **end)
index 3e817404fa9b2fa248c723c4faad117f6322966f..210681a933b4b9e47de6f69cea3d8167890e222f 100644 (file)
@@ -109,7 +109,7 @@ public:
   }
   void dump(Formatter *f) const;
 
-  static void generate_test_instances(list<entity_name_t>& o);
+  static void generate_test_instances(list<entity_name_t*>& o);
 };
 WRITE_CLASS_ENCODER(entity_name_t)
 
@@ -325,7 +325,7 @@ struct entity_addr_t {
 
   void dump(Formatter *f) const;
 
-  static void generate_test_instances(list<entity_addr_t>& o);
+  static void generate_test_instances(list<entity_addr_t*>& o);
 };
 WRITE_CLASS_ENCODER(entity_addr_t)
 
index d627e21caed3cc34ad5de7cec256cd3174d236d7..ea8ffe6bf55e570aae4c0121c854883006836c4d 100644 (file)
@@ -502,45 +502,47 @@ void ObjectStore::Transaction::dump(ostream& out)
   }
 }
 
-void ObjectStore::Transaction::generate_test_instances(list<ObjectStore::Transaction>& o)
+void ObjectStore::Transaction::generate_test_instances(list<ObjectStore::Transaction*>& o)
 {
-  Transaction t;
-  o.push_back(t);
+  o.push_back(new Transaction);
 
-  t.nop();
+  Transaction *t = new Transaction;
+  t->nop();
   o.push_back(t);
   
+  t = new Transaction;
   coll_t c("foocoll");
   coll_t c2("foocoll2");
   hobject_t o1("obj", "", 123, 456);
   hobject_t o2("obj2", "", 123, 456);
-  t.touch(c, o1);
+  t->touch(c, o1);
   bufferlist bl;
   bl.append("some data");
-  t.write(c, o1, 1, bl.length(), bl);
-  t.zero(c, o1, 22, 33);
-  t.truncate(c, o1, 99);
-  t.remove(c, o1);
+  t->write(c, o1, 1, bl.length(), bl);
+  t->zero(c, o1, 22, 33);
+  t->truncate(c, o1, 99);
+  t->remove(c, o1);
   o.push_back(t);
 
-  t.setattr(c, o1, "key", bl);
+  t = new Transaction;
+  t->setattr(c, o1, "key", bl);
   map<string,bufferptr> m;
   m["a"] = buffer::copy("this", 4);
   m["b"] = buffer::copy("that", 4);
-  t.setattrs(c, o1, m);
-  t.rmattr(c, o1, "b");
-  t.rmattrs(c, o1);
-
-  t.clone(c, o1, o2);
-  t.clone_range(c, o1, o2, 1, 12, 99);
-
-  t.create_collection(c);
-  t.collection_add(c, c2, o1);
-  t.collection_add(c, c2, o2);
-  t.remove_collection(c);
-  t.collection_setattr(c, "this", bl);
-  t.collection_rmattr(c, "foo");
-  t.collection_setattrs(c, m);
-  t.collection_rename(c, c2);
+  t->setattrs(c, o1, m);
+  t->rmattr(c, o1, "b");
+  t->rmattrs(c, o1);
+
+  t->clone(c, o1, o2);
+  t->clone_range(c, o1, o2, 1, 12, 99);
+
+  t->create_collection(c);
+  t->collection_add(c, c2, o1);
+  t->collection_add(c, c2, o2);
+  t->remove_collection(c);
+  t->collection_setattr(c, "this", bl);
+  t->collection_rmattr(c, "foo");
+  t->collection_setattrs(c, m);
+  t->collection_rename(c, c2);
   o.push_back(t);  
 }
index be5531d949f5310a1e5f7dad65ef4cd65327cfde..f98c28594d979b39ad7129870c18b3909204afba 100644 (file)
@@ -518,7 +518,7 @@ public:
 
     void dump(ostream& out);
     void dump(ceph::Formatter *f);
-    static void generate_test_instances(list<Transaction>& o);
+    static void generate_test_instances(list<Transaction*>& o);
   };
 
   struct C_DeleteTransaction : public Context {
index 5b1a0147ed1144235f98535637918af1322d6982..c4d4911856b3673f5bcba5ebd48b23530a67288d 100644 (file)
@@ -57,18 +57,16 @@ void osd_info_t::decode(bufferlist::iterator& bl)
   ::decode(lost_at, bl);
 }
 
-void osd_info_t::generate_test_instances(list<osd_info_t>& o)
+void osd_info_t::generate_test_instances(list<osd_info_t*>& o)
 {
-  osd_info_t a;
-  o.push_back(a);
-
-  a.last_clean_begin = 1;
-  a.last_clean_end = 2;
-  a.up_from = 30;
-  a.up_thru = 40;
-  a.down_at = 5;
-  a.lost_at = 6;
-  o.push_back(a);
+  o.push_back(new osd_info_t);
+  o.push_back(new osd_info_t);
+  o.back()->last_clean_begin = 1;
+  o.back()->last_clean_end = 2;
+  o.back()->up_from = 30;
+  o.back()->up_thru = 40;
+  o.back()->down_at = 5;
+  o.back()->lost_at = 6;
 }
 
 ostream& operator<<(ostream& out, const osd_info_t& info)
@@ -743,17 +741,14 @@ void OSDMap::dump(Formatter *f) const
   f->close_section();
 }
 
-void OSDMap::generate_test_instances(list<OSDMap>& o)
+void OSDMap::generate_test_instances(list<OSDMap*>& o)
 {
-  OSDMap m;
-  o.push_back(m);
+  o.push_back(new OSDMap);
 
   CephContext *cct = new CephContext(CODE_ENVIRONMENT_UTILITY);
-
+  o.push_back(new OSDMap);
   uuid_d fsid;
-  m.build_simple(cct, 1, fsid, 16, 7, 8, 9);
-  o.push_back(m);
-
+  o.back()->build_simple(cct, 1, fsid, 16, 7, 8, 9);
   delete cct;
 }
 
index 4daaaebda67ee9157dfbff3aa5f228fb93510f96..7d7a58be084707b6a9b6a9933b4e86ad1aaffe7b 100644 (file)
@@ -93,7 +93,7 @@ struct osd_info_t {
   void dump(Formatter *f) const;
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
-  static void generate_test_instances(list<osd_info_t>& o);
+  static void generate_test_instances(list<osd_info_t*>& o);
 };
 WRITE_CLASS_ENCODER(osd_info_t)
 
@@ -672,7 +672,7 @@ public:
   string get_flag_string() const;
   void dump_json(ostream& out) const;
   void dump(Formatter *f) const;
-  static void generate_test_instances(list<OSDMap>& o);
+  static void generate_test_instances(list<OSDMap*>& o);
 };
 WRITE_CLASS_ENCODER(OSDMap)
 
index 4c5c0940c04810507bee47502b94d4db61bd0379..13f0c642c58752cbfe2797a1c859c1a6ad09860a 100644 (file)
@@ -714,12 +714,11 @@ public:
       f->dump_unsigned("head", head);
       f->dump_unsigned("tail", tail);
     }
-    static void generate_test_instances(list<OndiskLog>& o) {
-      OndiskLog a;
-      o.push_back(a);
-      a.tail = 1;
-      a.head = 2;
-      o.push_back(a);
+    static void generate_test_instances(list<OndiskLog*>& o) {
+      o.push_back(new OndiskLog);
+      o.push_back(new OndiskLog);
+      o.back()->tail = 1;
+      o.back()->head = 2;
     }
   };
   WRITE_CLASS_ENCODER(OndiskLog)
@@ -894,16 +893,15 @@ public:
        f->dump_int("osd", *p);
       f->close_section();
     }
-    static void generate_test_instances(list<Interval>& o) {
-      Interval a;
-      o.push_back(a);
-      a.up.push_back(1);
-      a.acting.push_back(2);
-      a.acting.push_back(3);
-      a.first = 4;
-      a.last = 5;
-      a.maybe_went_rw = true;
-      o.push_back(a);
+    static void generate_test_instances(list<Interval*>& o) {
+      o.push_back(new Interval);
+      o.push_back(new Interval);
+      o.back()->up.push_back(1);
+      o.back()->acting.push_back(2);
+      o.back()->acting.push_back(3);
+      o.back()->first = 4;
+      o.back()->last = 5;
+      o.back()->maybe_went_rw = true;
     }
   };
   WRITE_CLASS_ENCODER(Interval)
index c72f278e550a5be19022dcda31d466ffe633f2ce..c262a23910393b0e98fd4f28a35b66583b90e394 100644 (file)
@@ -35,22 +35,20 @@ void osd_reqid_t::decode(bufferlist::iterator &bl)
 }
 
 // -- osd_stat_t --
-void osd_stat_t::generate_test_instances(std::list<osd_stat_t>& o)
+void osd_stat_t::generate_test_instances(std::list<osd_stat_t*>& o)
 {
-  osd_stat_t z;
-  o.push_back(z);
+  o.push_back(new osd_stat_t);
 
-  osd_stat_t a;
-  a.kb = 1;
-  a.kb_used = 2;
-  a.kb_avail = 3;
-  a.hb_in.push_back(5);
-  a.hb_in.push_back(6);
-  a.hb_out = a.hb_in;
-  a.hb_out.push_back(7);
-  a.snap_trim_queue_len = 8;
-  a.num_snap_trimming = 99;
-  o.push_back(a);
+  o.push_back(new osd_stat_t);
+  o.back()->kb = 1;
+  o.back()->kb_used = 2;
+  o.back()->kb_avail = 3;
+  o.back()->hb_in.push_back(5);
+  o.back()->hb_in.push_back(6);
+  o.back()->hb_out = o.back()->hb_in;
+  o.back()->hb_out.push_back(7);
+  o.back()->snap_trim_queue_len = 8;
+  o.back()->num_snap_trimming = 99;
 }
 
 // -- pg_t --
@@ -251,14 +249,13 @@ void pool_snap_info_t::decode(bufferlist::iterator& bl)
   ::decode(name, bl);
 }
 
-void pool_snap_info_t::generate_test_instances(list<pool_snap_info_t>& o)
+void pool_snap_info_t::generate_test_instances(list<pool_snap_info_t*>& o)
 {
-  pool_snap_info_t a;
-  o.push_back(a);
-  a.snapid = 1;
-  a.stamp = utime_t(1, 2);
-  a.name = "foo";
-  o.push_back(a);  
+  o.push_back(new pool_snap_info_t);
+  o.push_back(new pool_snap_info_t);
+  o.back()->snapid = 1;
+  o.back()->stamp = utime_t(1, 2);
+  o.back()->name = "foo";
 }
 
 
@@ -530,10 +527,10 @@ void pg_pool_t::decode(bufferlist::iterator& bl)
   calc_pg_masks();
 }
 
-void pg_pool_t::generate_test_instances(list<pg_pool_t>& o)
+void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
 {
   pg_pool_t a;
-  o.push_back(a);
+  o.push_back(new pg_pool_t(a));
 
   a.type = TYPE_REP;
   a.size = 2;
@@ -548,7 +545,7 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t>& o)
   a.snap_epoch = 11;
   a.auid = 12;
   a.crash_replay_interval = 13;
-  o.push_back(a);
+  o.push_back(new pg_pool_t(a));
 
   a.snaps[3].name = "asdf";
   a.snaps[3].snapid = 3;
@@ -556,10 +553,10 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t>& o)
   a.snaps[6].name = "qwer";
   a.snaps[6].snapid = 6;
   a.snaps[6].stamp = utime_t(23423, 4);
-  o.push_back(a);
+  o.push_back(new pg_pool_t(a));
 
   a.removed_snaps.insert(2);   // not quite valid to combine with snaps!
-  o.push_back(a);
+  o.push_back(new pg_pool_t(a));
 }
 
 ostream& operator<<(ostream& out, const pg_pool_t& p)
@@ -638,10 +635,10 @@ void object_stat_sum_t::decode(bufferlist::iterator& bl)
   ::decode(num_wr_kb, bl);
 }
 
-void object_stat_sum_t::generate_test_instances(list<object_stat_sum_t>& o)
+void object_stat_sum_t::generate_test_instances(list<object_stat_sum_t*>& o)
 {
   object_stat_sum_t a;
-  o.push_back(a);
+  o.push_back(new object_stat_sum_t(a));
 
   a.num_bytes = 1;
   a.num_objects = 3;
@@ -652,7 +649,7 @@ void object_stat_sum_t::generate_test_instances(list<object_stat_sum_t>& o)
   a.num_objects_unfound = 8;
   a.num_rd = 9; a.num_rd_kb = 10;
   a.num_wr = 11; a.num_wr_kb = 12;
-  o.push_back(a);
+  o.push_back(new object_stat_sum_t(a));
 }
 
 void object_stat_sum_t::add(const object_stat_sum_t& o)
@@ -718,17 +715,17 @@ void object_stat_collection_t::decode(bufferlist::iterator& bl)
   ::decode(cat_sum, bl);
 }
 
-void object_stat_collection_t::generate_test_instances(list<object_stat_collection_t>& o)
+void object_stat_collection_t::generate_test_instances(list<object_stat_collection_t*>& o)
 {
   object_stat_collection_t a;
-  o.push_back(a);
-  list<object_stat_sum_t> l;
+  o.push_back(new object_stat_collection_t(a));
+  list<object_stat_sum_t*> l;
   object_stat_sum_t::generate_test_instances(l);
   char n[2] = { 'a', 0 };
-  for (list<object_stat_sum_t>::iterator p = l.begin(); p != l.end(); ++p) {
-    a.add(*p, n);
+  for (list<object_stat_sum_t*>::iterator p = l.begin(); p != l.end(); ++p) {
+    a.add(**p, n);
     n[0]++;
-    o.push_back(a);
+    o.push_back(new object_stat_collection_t(a));
   }
 }
 
@@ -844,10 +841,10 @@ void pg_stat_t::decode(bufferlist::iterator &bl)
   }
 }
 
-void pg_stat_t::generate_test_instances(list<pg_stat_t>& o)
+void pg_stat_t::generate_test_instances(list<pg_stat_t*>& o)
 {
   pg_stat_t a;
-  o.push_back(a);
+  o.push_back(new pg_stat_t(a));
 
   a.version = eversion_t(1, 3);
   a.reported = eversion_t(1, 2);
@@ -860,14 +857,14 @@ void pg_stat_t::generate_test_instances(list<pg_stat_t>& o)
   a.parent_split_bits = 12;
   a.last_scrub = eversion_t(9, 10);
   a.last_scrub_stamp = utime_t(11, 12);
-  list<object_stat_collection_t> l;
+  list<object_stat_collection_t*> l;
   object_stat_collection_t::generate_test_instances(l);
-  a.stats = l.back();
+  a.stats = *l.back();
   a.log_size = 99;
   a.ondisk_log_size = 88;
   a.up.push_back(123);
   a.acting.push_back(456);
-  o.push_back(a);
+  o.push_back(new pg_stat_t(a));
 }
 
 
@@ -920,17 +917,17 @@ void pool_stat_t::decode(bufferlist::iterator &bl)
   }
 }
 
-void pool_stat_t::generate_test_instances(list<pool_stat_t>& o)
+void pool_stat_t::generate_test_instances(list<pool_stat_t*>& o)
 {
   pool_stat_t a;
-  o.push_back(a);
+  o.push_back(new pool_stat_t(a));
 
-  list<object_stat_collection_t> l;
+  list<object_stat_collection_t*> l;
   object_stat_collection_t::generate_test_instances(l);
-  a.stats = l.back();
+  a.stats = *l.back();
   a.log_size = 123;
   a.ondisk_log_size = 456;
-  o.push_back(a);
+  o.push_back(new pool_stat_t(a));
 }
 
 
@@ -995,10 +992,10 @@ void OSDSuperblock::dump(Formatter *f) const
   f->dump_int("last_epoch_mounted", mounted);
 }
 
-void OSDSuperblock::generate_test_instances(list<OSDSuperblock>& o)
+void OSDSuperblock::generate_test_instances(list<OSDSuperblock*>& o)
 {
   OSDSuperblock z;
-  o.push_back(z);
+  o.push_back(new OSDSuperblock(z));
   memset(&z.cluster_fsid, 1, sizeof(z.cluster_fsid));
   memset(&z.osd_fsid, 2, sizeof(z.osd_fsid));
   z.whoami = 3;
@@ -1007,7 +1004,7 @@ void OSDSuperblock::generate_test_instances(list<OSDSuperblock>& o)
   z.newest_map = 9;
   z.mounted = 8;
   z.clean_thru = 7;
-  o.push_back(z);
+  o.push_back(new OSDSuperblock(z));
 }
 
 // -- SnapSet --
@@ -1072,14 +1069,12 @@ void watch_info_t::dump(Formatter *f) const
   f->dump_unsigned("timeout_seconds", timeout_seconds);
 }
 
-void watch_info_t::generate_test_instances(list<watch_info_t>& o)
+void watch_info_t::generate_test_instances(list<watch_info_t*>& o)
 {
-  watch_info_t a;
-  o.push_back(a);
-  a.cookie = 123;
-  a.timeout_seconds = 99;
-  o.push_back(a);
+  o.push_back(new watch_info_t);
+  o.push_back(new watch_info_t);
+  o.back()->cookie = 123;
+  o.back()->timeout_seconds = 99;
 }
 
 
@@ -1208,10 +1203,9 @@ void object_info_t::dump(Formatter *f) const
   f->close_section();
 }
 
-void object_info_t::generate_test_instances(list<object_info_t>& o)
+void object_info_t::generate_test_instances(list<object_info_t*>& o)
 {
-  object_info_t a;
-  o.push_back(a);
+  o.push_back(new object_info_t());
   
   // fixme
 }
index 4a614e7cde66021b310289ecb3ed92790fd4567b..2a62a422cfb1f83e12f2be8f14afbba13d91098f 100644 (file)
@@ -445,7 +445,7 @@ struct osd_stat_t {
     ::decode(hb_out, bl);
   }
 
-  static void generate_test_instances(std::list<osd_stat_t>& o);
+  static void generate_test_instances(std::list<osd_stat_t*>& o);
   
   void add(const osd_stat_t& o) {
     kb += o.kb;
@@ -525,7 +525,7 @@ struct pool_snap_info_t {
   void dump(Formatter *f) const;
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
-  static void generate_test_instances(list<pool_snap_info_t>& o);
+  static void generate_test_instances(list<pool_snap_info_t*>& o);
 };
 WRITE_CLASS_ENCODER(pool_snap_info_t)
 
@@ -667,7 +667,7 @@ struct pg_pool_t {
   void encode(bufferlist& bl, uint64_t features) const;
   void decode(bufferlist::iterator& bl);
 
-  static void generate_test_instances(list<pg_pool_t>& o);
+  static void generate_test_instances(list<pg_pool_t*>& o);
 };
 WRITE_CLASS_ENCODER_FEATURES(pg_pool_t)
 
@@ -711,7 +711,7 @@ struct object_stat_sum_t {
   void dump(Formatter *f) const;
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
-  static void generate_test_instances(list<object_stat_sum_t>& o);
+  static void generate_test_instances(list<object_stat_sum_t*>& o);
 };
 WRITE_CLASS_ENCODER(object_stat_sum_t)
 
@@ -733,7 +733,7 @@ struct object_stat_collection_t {
   void dump(Formatter *f) const;
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
-  static void generate_test_instances(list<object_stat_collection_t>& o);
+  static void generate_test_instances(list<object_stat_collection_t*>& o);
 
   void clear() {
     sum.clear();
@@ -809,7 +809,7 @@ struct pg_stat_t {
   void dump(Formatter *f) const;
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator &bl);
-  static void generate_test_instances(list<pg_stat_t>& o);
+  static void generate_test_instances(list<pg_stat_t*>& o);
 };
 WRITE_CLASS_ENCODER(pg_stat_t)
 
@@ -838,7 +838,7 @@ struct pool_stat_t {
   void dump(Formatter *f) const;
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator &bl);
-  static void generate_test_instances(list<pool_stat_t>& o);
+  static void generate_test_instances(list<pool_stat_t*>& o);
 };
 WRITE_CLASS_ENCODER(pool_stat_t)
 
@@ -927,7 +927,7 @@ public:
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator &bl);
   void dump(Formatter *f) const;
-  static void generate_test_instances(list<OSDSuperblock>& o);
+  static void generate_test_instances(list<OSDSuperblock*>& o);
 };
 WRITE_CLASS_ENCODER(OSDSuperblock)
 
@@ -990,7 +990,7 @@ struct watch_info_t {
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
   void dump(Formatter *f) const;
-  static void generate_test_instances(list<watch_info_t>& o);
+  static void generate_test_instances(list<watch_info_t*>& o);
 };
 WRITE_CLASS_ENCODER(watch_info_t)
 
@@ -1047,7 +1047,7 @@ struct object_info_t {
     decode(p);
   }
   void dump(Formatter *f) const;
-  static void generate_test_instances(list<object_info_t>& o);
+  static void generate_test_instances(list<object_info_t*>& o);
 
   explicit object_info_t()
     : size(0), lost(false),
index ba2e0252a75f5d2ba77d3adbb51dd190451bd2bd..1c54bb658851fabcecb7876b46ed3ed202f014e0 100644 (file)
@@ -49,8 +49,8 @@ struct Dencoder {
 
 template<class T>
 class DencoderImpl : public Dencoder {
-  T m_object;
-  list<T> m_list;
+  T* m_object;
+  list<T*> m_list;
 
 public:
   DencoderImpl() {}
@@ -58,7 +58,7 @@ public:
   string decode(bufferlist bl) {
     bufferlist::iterator p = bl.begin();
     try {
-      ::decode(m_object, p);
+      ::decode(*m_object, p);
     }
     catch (buffer::error& e) {
       return e.what();
@@ -70,11 +70,11 @@ public:
 
   void encode(bufferlist& out, uint64_t features) {
     out.clear();
-    ::encode(m_object, out, features);
+    ::encode(*m_object, out, features);
   }
 
   void dump(Formatter *f) {
-    m_object.dump(f);
+    m_object->dump(f);
   }
 
   void generate() {
@@ -89,7 +89,7 @@ public:
       i = m_list.size();
     if (i > m_list.size())
       return "invalid id for generated object";
-    typename list<T>::iterator p = m_list.begin();
+    typename list<T*>::iterator p = m_list.begin();
     for (i--; i > 0 && p != m_list.end(); ++p, --i) ;
     m_object = *p;
     return string();
index 9c1e4e94e670968fe192eaf8df38630fde96abea..542b070047dc65decd123a650c04a2eb2fbfe585 100644 (file)
@@ -7,6 +7,20 @@ TYPE(entity_addr_t)
 TYPE(osd_info_t)
 TYPE(OSDMap)
 
+#include "osd/PG.h"
+//TYPE(PG::Info)
+//TYPE(PG::Info::History)
+//TYPE(PG::Query)
+//TYPE(PG::Missing::item)
+//TYPE(PG::Missing)
+//TYPE(PG::Log::Entry)
+//TYPE(PG::Log)
+TYPE(PG::Interval)
+TYPE(PG::OndiskLog)
+
+#include "osd/PGLS.h"
+//TYPE(PGLSResponse)
+
 #include "osd/osd_types.h"
 TYPE(osd_stat_t)
 TYPE(OSDSuperblock)
@@ -17,7 +31,7 @@ TYPE(object_stat_collection_t)
 TYPE(pg_stat_t)
 TYPE(pool_stat_t)
 TYPE(watch_info_t)
-//TYPE(object_info_t)
+TYPE(object_info_t)
 
 #include "os/ObjectStore.h"
 TYPE(ObjectStore::Transaction)