From: fang yuxiang Date: Mon, 8 Jan 2018 16:54:55 +0000 (+0800) Subject: rgw: make radosgw object stat RGW_ATTR_COMPRESSION dump readable X-Git-Tag: v13.0.2~612^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a5896e5c01f5998a6a4e4adc174248eff8e2dfce;p=ceph.git rgw: make radosgw object stat RGW_ATTR_COMPRESSION dump readable Signed-off-by: fang yuxiang fang.yuxiang@eisoo.com --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 03066016731..0e990371cb0 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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("compression", bl, formatter); } if (!handled) diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 48690abc9da..798970723f5 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -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); +} diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 62699a0e44d..2b9b9c468ca 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -196,6 +196,7 @@ struct compression_block { ::decode(len, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; }; WRITE_CLASS_ENCODER(compression_block) @@ -223,7 +224,8 @@ struct RGWCompressionInfo { ::decode(orig_size, bl); ::decode(blocks, bl); DECODE_FINISH(bl); - } + } + void dump(Formatter *f) const; }; WRITE_CLASS_ENCODER(RGWCompressionInfo)