From ff10064ab878e58afb1d2538b2086a2d4a41c017 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Fri, 15 Jul 2022 11:01:15 -0400 Subject: [PATCH] rgwlc: return std::string_view from sal::Zone::get_tier_type() Valid values are all small strings, often static. Signed-off-by: Matt Benjamin --- src/rgw/rgw_sal.h | 2 +- src/rgw/rgw_sal_dbstore.h | 2 +- src/rgw/rgw_sal_motr.h | 2 +- src/rgw/rgw_sal_rados.cc | 2 +- src/rgw/rgw_sal_rados.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index b2542772a6df2..799af26367db6 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -1496,7 +1496,7 @@ class Zone { /** Get the ID of the realm containing this zone */ virtual const std::string& get_realm_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 a5074d9a67bef..239211de6c851 100644 --- a/src/rgw/rgw_sal_dbstore.h +++ b/src/rgw/rgw_sal_dbstore.h @@ -335,7 +335,7 @@ protected: virtual const RGWAccessKey& get_system_key() override; virtual const std::string& get_realm_name() override; virtual const std::string& get_realm_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 StoreLuaScriptManager { diff --git a/src/rgw/rgw_sal_motr.h b/src/rgw/rgw_sal_motr.h index 130bcfbc9ec81..e2684637ca24c 100644 --- a/src/rgw/rgw_sal_motr.h +++ b/src/rgw/rgw_sal_motr.h @@ -457,7 +457,7 @@ class MotrZone : public StoreZone { virtual const RGWAccessKey& get_system_key() { return zone_params->system_key; } virtual const std::string& get_realm_name() { return realm->get_name(); } virtual const std::string& get_realm_id() { return realm->get_id(); } - virtual const std::string& get_tier_type() { return "rgw"; } + virtual const std::string_view get_tier_type() { return "rgw"; } friend class MotrStore; }; diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index 22ae73d3a63ca..e39b03f2511a1 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -3008,7 +3008,7 @@ const std::string& RadosZone::get_realm_id() return store->svc()->zone->get_realm().get_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 693c0569b7e0d..47fcb12797f66 100644 --- a/src/rgw/rgw_sal_rados.h +++ b/src/rgw/rgw_sal_rados.h @@ -107,7 +107,7 @@ class RadosZone : public StoreZone { virtual const RGWAccessKey& get_system_key() override; virtual const std::string& get_realm_name() override; virtual const std::string& get_realm_id() override; - virtual const std::string& get_tier_type() override; + virtual const std::string_view get_tier_type() override; }; class RadosStore : public StoreStore { -- 2.39.5