From: Matt Benjamin Date: Fri, 15 Jul 2022 15:01:15 +0000 (-0400) Subject: rgwlc: return std::string_view from sal::Zone::get_tier_type() X-Git-Tag: v17.2.8~130^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=772bbc1bd96d2cef39a4fd968dfe416163a850d6;p=ceph.git rgwlc: return std::string_view from sal::Zone::get_tier_type() Valid values are all small strings, often static. Signed-off-by: Matt Benjamin (cherry picked from commit ff10064ab878e58afb1d2538b2086a2d4a41c017) Conflicts: src/rgw/rgw_sal_dbstore.h (trivial) src/rgw/rgw_sal_motr.h (not exist) src/rgw/rgw_sal_rados.cc (trivial) src/rgw/rgw_sal_rados.h (trivial) --- diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index b3bdd98fa1d7..aab82b3a671d 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -1424,7 +1424,7 @@ class Zone { /** Get the current period ID for this zone */ virtual const std::string& get_current_period_id() = 0; /** Get the tier type for the zone */ - virtual const std::string& get_tier_type() = 0; + virtual const std::string_view get_tier_type() = 0; }; /** diff --git a/src/rgw/rgw_sal_dbstore.h b/src/rgw/rgw_sal_dbstore.h index 80656991f2dc..6788487d60aa 100644 --- a/src/rgw/rgw_sal_dbstore.h +++ b/src/rgw/rgw_sal_dbstore.h @@ -270,7 +270,7 @@ protected: virtual bool get_redirect_endpoint(std::string* endpoint) override; virtual bool has_zonegroup_api(const std::string& api) const override; virtual const std::string& get_current_period_id() override; - virtual const std::string& get_tier_type() override { return "rgw"; } + virtual const std::string_view get_tier_type() override { return "rgw"; } }; class DBLuaScriptManager : public LuaScriptManager { diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index b6b1416d1f73..d3d6c2f88326 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -2817,7 +2817,7 @@ const std::string& RadosZone::get_current_period_id() return store->svc()->zone->get_current_period_id(); } -const std::string& RadosZone::get_tier_type() +const std::string_view RadosZone::get_tier_type() { return store->svc()->zone->get_zone().tier_type; } diff --git a/src/rgw/rgw_sal_rados.h b/src/rgw/rgw_sal_rados.h index 37bc2baf9a6c..57ea7dc0b3ae 100644 --- a/src/rgw/rgw_sal_rados.h +++ b/src/rgw/rgw_sal_rados.h @@ -358,7 +358,7 @@ class RadosZone : public Zone { virtual bool get_redirect_endpoint(std::string* endpoint) override; virtual bool has_zonegroup_api(const std::string& api) const override; virtual const std::string& get_current_period_id() override; - virtual const std::string& get_tier_type() override; + virtual const std::string_view get_tier_type() override; }; class RadosStore : public Store {