@@ -578,6 +578,16 @@ struct RGWZoneGroupTierS3Glacier {
578578};
579579WRITE_CLASS_ENCODER (RGWZoneGroupTierS3Glacier)
580580
581+
582+ struct RGWTierType {
583+ static constexpr const char * CLOUD_S3 = " cloud-s3" ;
584+ static constexpr const char * CLOUD_S3_GLACIER = " cloud-s3-glacier" ;
585+
586+ static bool is_tier_type_supported (const std::string& t) {
587+ return ((t == CLOUD_S3) || (t == CLOUD_S3_GLACIER));
588+ }
589+ };
590+
581591struct RGWZoneGroupPlacementTier {
582592#define DEFAULT_READ_THROUGH_RESTORE_DAYS 1
583593
@@ -621,13 +631,13 @@ struct RGWZoneGroupPlacementTier {
621631 decode (storage_class, bl);
622632 decode (retain_head_object, bl);
623633 if (struct_v == 1 ) {
624- if (tier_type == " cloud-s3 " ) {
634+ if (tier_type == RGWTierType::CLOUD_S3 ) {
625635 decode (t.s3 , bl);
626636 }
627637 } else if (struct_v == 2 ) {
628638 decode (allow_read_through, bl);
629639 decode (read_through_restore_days, bl);
630- if (tier_type == " cloud-s3 " ) {
640+ if (tier_type == RGWTierType::CLOUD_S3 ) {
631641 decode (t.s3 , bl);
632642 }
633643 } else if (struct_v >= 3 ) {
@@ -647,22 +657,23 @@ struct RGWZoneGroupPlacementTier {
647657 }
648658
649659 bool is_tier_type_s3 () const {
650- return (tier_type == " cloud-s3" || tier_type == " cloud-s3-glacier" );
660+ return (tier_type == RGWTierType::CLOUD_S3 ||
661+ tier_type == RGWTierType::CLOUD_S3_GLACIER);
651662 }
652663
653664 bool is_tier_type_s3_glacier () const {
654- return (tier_type == " cloud-s3-glacier " );
665+ return (tier_type == RGWTierType::CLOUD_S3_GLACIER );
655666 }
656667
657668 void dump (Formatter *f) const ;
658669 void decode_json (JSONObj *obj);
659670 static void generate_test_instances (std::list<RGWZoneGroupPlacementTier*>& o) {
660671 o.push_back (new RGWZoneGroupPlacementTier);
661672 o.push_back (new RGWZoneGroupPlacementTier);
662- o.back ()->tier_type = " cloud-s3 " ;
663- o.back ()->storage_class = " STANDARD " ;
673+ o.back ()->tier_type = RGWTierType::CLOUD_S3 ;
674+ o.back ()->storage_class = RGW_STORAGE_CLASS_STANDARD ;
664675 o.back ()->allow_read_through = false ;
665- o.back ()->restore_storage_class = " STANDARD " ;
676+ o.back ()->restore_storage_class = RGW_STORAGE_CLASS_STANDARD ;
666677 o.back ()->s3_glacier .glacier_restore_days = 2 ;
667678 o.back ()->s3_glacier .glacier_restore_tier_type = GlacierRestoreTierType::Expedited;
668679 }
@@ -715,14 +726,14 @@ struct RGWZoneGroupPlacementTarget {
715726 void decode_json (JSONObj *obj);
716727 static void generate_test_instances (std::list<RGWZoneGroupPlacementTarget*>& o) {
717728 o.push_back (new RGWZoneGroupPlacementTarget);
718- o.back ()->storage_classes .insert (" STANDARD " );
729+ o.back ()->storage_classes .insert (RGW_STORAGE_CLASS_STANDARD );
719730 o.push_back (new RGWZoneGroupPlacementTarget);
720731 o.back ()->name = " target" ;
721732 o.back ()->tags .insert (" tag1" );
722733 o.back ()->tags .insert (" tag2" );
723734 o.back ()->storage_classes .insert (" STANDARD_IA" );
724- o.back ()->tier_targets [" cloud-s3 " ].tier_type = " cloud-s3 " ;
725- o.back ()->tier_targets [" cloud-s3 " ].storage_class = " STANDARD " ;
735+ o.back ()->tier_targets [RGWTierType::CLOUD_S3 ].tier_type = RGWTierType::CLOUD_S3 ;
736+ o.back ()->tier_targets [RGWTierType::CLOUD_S3 ].storage_class = RGW_STORAGE_CLASS_STANDARD ;
726737 }
727738};
728739WRITE_CLASS_ENCODER (RGWZoneGroupPlacementTarget)
0 commit comments