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)
}
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)
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)
}
}
-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);
}
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 {
::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)
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;
}
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)
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)
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)
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)
}
// -- 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 --
::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";
}
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;
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;
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)
::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;
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)
::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));
}
}
}
}
-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);
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));
}
}
}
-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));
}
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;
z.newest_map = 9;
z.mounted = 8;
z.clean_thru = 7;
- o.push_back(z);
+ o.push_back(new OSDSuperblock(z));
}
// -- SnapSet --
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;
}
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
}
::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;
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)
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)
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)
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();
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)
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)
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)
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)
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),
template<class T>
class DencoderImpl : public Dencoder {
- T m_object;
- list<T> m_list;
+ T* m_object;
+ list<T*> m_list;
public:
DencoderImpl() {}
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();
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() {
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();
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)
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)