rgw: make radosgw object stat RGW_ATTR_COMPRESSION dump readable

Signed-off-by: fang yuxiang fang.yuxiang@eisoo.com
This commit is contained in:
fang yuxiang 2018-01-09 00:54:55 +08:00
parent 158f3173de
commit a5896e5c01
3 changed files with 19 additions and 1 deletions

View File

@ -5886,6 +5886,8 @@ next:
handled = dump_string("tag", bl, formatter);
} else if (iter->first == RGW_ATTR_ETAG) {
handled = dump_string("etag", bl, formatter);
} else if (iter->first == RGW_ATTR_COMPRESSION) {
handled = decode_dump<RGWCompressionInfo>("compression", bl, formatter);
}
if (!handled)

View File

@ -1634,3 +1634,17 @@ void RGWLifecycleConfiguration::dump(Formatter *f) const
}
f->close_section();
}
void compression_block::dump(Formatter *f) const
{
f->dump_unsigned("old_ofs", old_ofs);
f->dump_unsigned("new_ofs", new_ofs);
f->dump_unsigned("len", len);
}
void RGWCompressionInfo::dump(Formatter *f) const
{
f->dump_string("compression_type", compression_type);
f->dump_unsigned("orig_size", orig_size);
::encode_json("blocks", blocks, f);
}

View File

@ -196,6 +196,7 @@ struct compression_block {
::decode(len, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
};
WRITE_CLASS_ENCODER(compression_block)
@ -224,6 +225,7 @@ struct RGWCompressionInfo {
::decode(blocks, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
};
WRITE_CLASS_ENCODER(RGWCompressionInfo)