}
bool is_tier_type_s3() {
- return (tier_type == "cloud-s3" || tier_type == "cloud-s3-glacier");
+ return (tier_type == RGWTierType::CLOUD_S3 ||
+ tier_type == RGWTierType::CLOUD_S3_GLACIER);
}
bool is_tier_type_s3_glacier() {
- return (tier_type == "cloud-s3-glacier");
+ return (tier_type == RGWTierType::CLOUD_S3_GLACIER);
}
inline void set_tier_type(std::string value) {
- /* Only "cloud-s3" & "cloud-s3-glacier" tier-type is supported for now */
- if (value == "cloud-s3" || value == "cloud-s3-glacier") {
+ /* Only RGWTierType::CLOUD_S3 & RGWTierType::CLOUD_S3_GLACIER
+ * tier-type are supported for now */
+ if (RGWTierType::is_tier_type_supported(value)) {
tier_type = value;
}
}
inline void set_tier_config(RGWObjTier t) {
- /* Set only if tier_type set to "cloud-s3" or "cloud-s3-glacier" */
+ /* Set only if tier_type set to RGWTierType::CLOUD_S3 or
+ * RGWTierType::CLOUD_S3_GLACIER */
if (!is_tier_type_s3())
return;
};
WRITE_CLASS_ENCODER(RGWZoneGroupTierS3Glacier)
+
+struct RGWTierType {
+ static constexpr const char* CLOUD_S3 = "cloud-s3";
+ static constexpr const char* CLOUD_S3_GLACIER = "cloud-s3-glacier";
+
+ static bool is_tier_type_supported(const std::string& t) {
+ return ((t == CLOUD_S3) || (t == CLOUD_S3_GLACIER));
+ }
+};
+
struct RGWZoneGroupPlacementTier {
#define DEFAULT_READ_THROUGH_RESTORE_DAYS 1
decode(storage_class, bl);
decode(retain_head_object, bl);
if (struct_v == 1) {
- if (tier_type == "cloud-s3") {
+ if (tier_type == RGWTierType::CLOUD_S3) {
decode(t.s3, bl);
}
} else if (struct_v == 2) {
decode(allow_read_through, bl);
decode(read_through_restore_days, bl);
- if (tier_type == "cloud-s3") {
+ if (tier_type == RGWTierType::CLOUD_S3) {
decode(t.s3, bl);
}
} else if (struct_v >= 3) {
}
bool is_tier_type_s3() const {
- return (tier_type == "cloud-s3" || tier_type == "cloud-s3-glacier");
+ return (tier_type == RGWTierType::CLOUD_S3 ||
+ tier_type == RGWTierType::CLOUD_S3_GLACIER);
}
bool is_tier_type_s3_glacier() const {
- return (tier_type == "cloud-s3-glacier");
+ return (tier_type == RGWTierType::CLOUD_S3_GLACIER);
}
void dump(Formatter *f) const;
static void generate_test_instances(std::list<RGWZoneGroupPlacementTier*>& o) {
o.push_back(new RGWZoneGroupPlacementTier);
o.push_back(new RGWZoneGroupPlacementTier);
- o.back()->tier_type = "cloud-s3";
- o.back()->storage_class = "STANDARD";
+ o.back()->tier_type = RGWTierType::CLOUD_S3;
+ o.back()->storage_class = RGW_STORAGE_CLASS_STANDARD;
o.back()->allow_read_through = false;
- o.back()->restore_storage_class = "STANDARD";
+ o.back()->restore_storage_class = RGW_STORAGE_CLASS_STANDARD;
o.back()->s3_glacier.glacier_restore_days = 2;
o.back()->s3_glacier.glacier_restore_tier_type = GlacierRestoreTierType::Expedited;
}
void decode_json(JSONObj *obj);
static void generate_test_instances(std::list<RGWZoneGroupPlacementTarget*>& o) {
o.push_back(new RGWZoneGroupPlacementTarget);
- o.back()->storage_classes.insert("STANDARD");
+ o.back()->storage_classes.insert(RGW_STORAGE_CLASS_STANDARD);
o.push_back(new RGWZoneGroupPlacementTarget);
o.back()->name = "target";
o.back()->tags.insert("tag1");
o.back()->tags.insert("tag2");
o.back()->storage_classes.insert("STANDARD_IA");
- o.back()->tier_targets["cloud-s3"].tier_type = "cloud-s3";
- o.back()->tier_targets["cloud-s3"].storage_class = "STANDARD";
+ o.back()->tier_targets[RGWTierType::CLOUD_S3].tier_type = RGWTierType::CLOUD_S3;
+ o.back()->tier_targets[RGWTierType::CLOUD_S3].storage_class = RGW_STORAGE_CLASS_STANDARD;
}
};
WRITE_CLASS_ENCODER(RGWZoneGroupPlacementTarget)