ceph-dencoder: pg_t

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
Sage Weil 2012-02-05 22:20:51 -08:00 committed by Sage Weil
parent 8791cb98fe
commit 8bf08abc6a
3 changed files with 18 additions and 0 deletions

View File

@ -78,6 +78,21 @@ bool pg_t::parse(const char *s)
return true;
}
void pg_t::dump(Formatter *f) const
{
f->dump_unsigned("pool", m_pool);
f->dump_unsigned("seed", m_seed);
f->dump_int("preferred_osd", m_preferred);
}
void pg_t::generate_test_instances(list<pg_t*>& o)
{
o.push_back(new pg_t);
o.push_back(new pg_t(1, 2, -1));
o.push_back(new pg_t(13123, 3, -1));
o.push_back(new pg_t(131223, 4, 23));
}
ostream& operator<<(ostream& out, const pg_t &pg)
{
out << pg.pool() << '.';

View File

@ -193,6 +193,8 @@ struct pg_t {
::decode(opg, bl);
*this = opg;
}
void dump(Formatter *f) const;
static void generate_test_instances(list<pg_t*>& o);
};
WRITE_CLASS_ENCODER(pg_t)

View File

@ -21,6 +21,7 @@ TYPE(PG::Interval)
TYPE(PG::OndiskLog)
#include "osd/osd_types.h"
TYPE(pg_t)
TYPE(osd_stat_t)
TYPE(OSDSuperblock)
TYPE(pool_snap_info_t)