]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make radosgw object stat RGW_ATTR_COMPRESSION dump readable 19846/head
authorfang yuxiang <fang.yuxiang@eisoo.com>
Mon, 8 Jan 2018 16:54:55 +0000 (00:54 +0800)
committerfang yuxiang <fang.yuxiang@eisoo.com>
Mon, 8 Jan 2018 16:54:55 +0000 (00:54 +0800)
Signed-off-by: fang yuxiang fang.yuxiang@eisoo.com
src/rgw/rgw_admin.cc
src/rgw/rgw_json_enc.cc
src/rgw/rgw_rados.h

index 03066016731305b67403c48ebba88dc3e2d46a2e..0e990371cb02590cc9fbe4671eb09b656b35dc72 100644 (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)
index 48690abc9da1c9d8b106b96f1022fa2627ed510b..798970723f51d0d480521e163c4adae73cd2a60c 100644 (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);
+}
index 62699a0e44d721aab26fd6614f3e2c62a2cd0b07..2b9b9c468cac5a788a8fbc668ed160609c5ca9a8 100644 (file)
@@ -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)