]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: auth_registry uses unique_ptr instead of shared_ptr
authorCasey Bodley <cbodley@redhat.com>
Wed, 2 Nov 2022 17:14:42 +0000 (13:14 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 9 Dec 2022 21:29:16 +0000 (16:29 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_appmain.cc
src/rgw/rgw_auth_registry.h
src/rgw/rgw_process.h

index a572d763ff96ff4eea61f42d1ea1763e43c102d7..bef2bddd9bef03b1f381bce3132f681667978161 100644 (file)
@@ -390,8 +390,6 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
    * the dynamic reconfiguration. */
   implicit_tenant_context.reset(new rgw::auth::ImplicitTenants{g_conf()});
   g_conf().add_observer(implicit_tenant_context.get());
-  auto auth_registry =
-    rgw::auth::StrategyRegistry::create(dpp->get_cct(), *implicit_tenant_context, env.driver);
 
   /* allocate a mime table (you'd never guess that from the name) */
   rgw_tools_init(dpp, dpp->get_cct());
@@ -406,7 +404,8 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
   // initialize RGWProcessEnv
   env.rest = &rest;
   env.olog = olog;
-  env.auth_registry = auth_registry;
+  env.auth_registry = rgw::auth::StrategyRegistry::create(
+      dpp->get_cct(), *implicit_tenant_context, env.driver);
   env.ratelimiting = ratelimiter.get();
   env.lua_background = lua_background.get();
 
index 003c32d87ebdaf07d2c361bcc9d8fa183028df03..992ee46e81c736faef6471ac4cbfaee00895e607 100644 (file)
@@ -84,11 +84,11 @@ public:
     return sts_strategy;
   }
 
-  static std::shared_ptr<StrategyRegistry>
+  static std::unique_ptr<StrategyRegistry>
   create(CephContext* const cct,
          const ImplicitTenants& implicit_tenant_context,
          rgw::sal::Driver* driver) {
-    return std::make_shared<StrategyRegistry>(cct, implicit_tenant_context, driver);
+    return std::make_unique<StrategyRegistry>(cct, implicit_tenant_context, driver);
   }
 };
 
@@ -96,6 +96,6 @@ public:
 } /* namespace rgw */
 
 using rgw_auth_registry_t = rgw::auth::StrategyRegistry;
-using rgw_auth_registry_ptr_t = std::shared_ptr<rgw_auth_registry_t>;
+using rgw_auth_registry_ptr_t = std::unique_ptr<rgw_auth_registry_t>;
 
 #endif /* CEPH_RGW_AUTH_REGISTRY_H */
index 36f7ba924de51f4dbb5ab6c8c51999f65c846d88..d3a9f5cc24e808a972d25d5a728bed44d054c3bd 100644 (file)
@@ -32,7 +32,7 @@ struct RGWProcessEnv {
   rgw::sal::Driver* driver = nullptr;
   RGWREST *rest = nullptr;
   OpsLogSink *olog = nullptr;
-  std::shared_ptr<rgw::auth::StrategyRegistry> auth_registry;
+  rgw_auth_registry_ptr_t auth_registry;
   ActiveRateLimiter* ratelimiting = nullptr;
   rgw::lua::Background* lua_background = nullptr;
 };