encode_json("data_pool", data_pool, f);
encode_json("data_extra_pool", data_extra_pool, f);
encode_json("index_type", (uint32_t)index_type, f);
+ encode_json("compression", compression_type, f);
}
void RGWZonePlacementInfo::decode_json(JSONObj *obj)
uint32_t it;
JSONDecoder::decode_json("index_type", it, obj);
index_type = (RGWBucketIndexType)it;
+ JSONDecoder::decode_json("compression", compression_type, obj);
}
void RGWZoneParams::decode_json(JSONObj *obj)
return RGWSystemMetaObj::set_as_default(exclusive);
}
+const string& RGWZoneParams::get_compression_type(const string& placement_rule) const
+{
+ static const std::string NONE{"none"};
+ auto p = placement_pools.find(placement_rule);
+ if (p == placement_pools.end()) {
+ return NONE;
+ }
+ const auto& type = p->second.compression_type;
+ return !type.empty() ? type : NONE;
+}
+
void RGWPeriodMap::encode(bufferlist& bl) const {
ENCODE_START(2, 1, bl);
::encode(id, bl);
string data_pool;
string data_extra_pool; /* if not set we should use data_pool */
RGWBucketIndexType index_type;
+ std::string compression_type;
RGWZonePlacementInfo() : index_type(RGWBIType_Normal) {}
void encode(bufferlist& bl) const {
- ENCODE_START(5, 1, bl);
+ ENCODE_START(6, 1, bl);
::encode(index_pool, bl);
::encode(data_pool, bl);
::encode(data_extra_pool, bl);
::encode((uint32_t)index_type, bl);
+ ::encode(compression_type, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
- DECODE_START(5, bl);
+ DECODE_START(6, bl);
::decode(index_pool, bl);
::decode(data_pool, bl);
if (struct_v >= 4) {
::decode(it, bl);
index_type = (RGWBucketIndexType)it;
}
+ if (struct_v >= 6) {
+ ::decode(compression_type, bl);
+ }
DECODE_FINISH(bl);
}
const string& get_data_extra_pool() {
int create_default(bool old_format = false);
int create(bool exclusive = true);
int fix_pool_names();
+
+ const string& get_compression_type(const string& placement_rule) const;
void encode(bufferlist& bl) const {
ENCODE_START(8, 1, bl);