#include "include/stringify.h"
#include "rgw_main.h"
#include "rgw_common.h"
-#include "rgw_sal_rados.h"
+#include "rgw_sal.h"
+#include "rgw_sal_config.h"
#include "rgw_period_pusher.h"
#include "rgw_realm_reloader.h"
#include "rgw_rest.h"
OpsLogFile* rgw::AppMain::ops_log_file;
+rgw::AppMain::AppMain(const DoutPrefixProvider* dpp) : dpp(dpp)
+{
+}
+rgw::AppMain::~AppMain() = default;
+
void rgw::AppMain::init_frontends1(bool nfs)
{
this->nfs = nfs;
}
} /* init_numa */
-void rgw::AppMain::init_storage()
+int rgw::AppMain::init_storage()
{
- auto run_gc =
+ auto config_store_type = g_conf().get_val<std::string>("rgw_config_store");
+ cfgstore = DriverManager::create_config_store(dpp, config_store_type);
+ if (!cfgstore) {
+ return -EIO;
+ }
+ env.cfgstore = cfgstore.get();
+
+ int r = site.load(dpp, null_yield, cfgstore.get());
+ if (r < 0) {
+ return r;
+ }
+ env.site = &site;
+
+ auto run_gc =
(g_conf()->rgw_enable_gc_threads &&
((!nfs) || (nfs && g_conf()->rgw_nfs_run_gc_threads)));
g_conf().get_val<bool>("rgw_dynamic_resharding"),
true, // run notification thread
g_conf()->rgw_cache_enabled);
-
+ if (!env.driver) {
+ return -EIO;
+ }
+ return 0;
} /* init_storage */
void rgw::AppMain::init_perfcounters()
lua_background->shutdown();
}
+ cfgstore.reset(); // deletes
DriverManager::close_storage(env.driver);
rgw_tools_cleanup();
main.init_perfcounters();
main.init_http_clients();
- main.init_storage();
- if (! main.get_driver()) {
+ r = main.init_storage();
+ if (r < 0) {
mutex.lock();
init_timer.cancel_all_events();
init_timer.shutdown();
mutex.unlock();
derr << "Couldn't init storage provider (RADOS)" << dendl;
- return EIO;
+ return -r;
}
main.cond_init_apis();
namespace rgw {
namespace lua { class Background; }
+namespace sal { class ConfigStore; }
class RGWLib;
class AppMain {
std::unique_ptr<RGWFrontendPauser> fe_pauser;
std::unique_ptr<RGWRealmWatcher> realm_watcher;
std::unique_ptr<RGWPauser> rgw_pauser;
- DoutPrefixProvider* dpp;
+ std::unique_ptr<sal::ConfigStore> cfgstore;
+ SiteConfig site;
+ const DoutPrefixProvider* dpp;
RGWProcessEnv env;
public:
- AppMain(DoutPrefixProvider* dpp)
- : dpp(dpp)
- {}
+ AppMain(const DoutPrefixProvider* dpp);
+ ~AppMain();
void shutdown(std::function<void(void)> finalize_async_signals
= []() { /* nada */});
+ sal::ConfigStore* get_config_store() const {
+ return cfgstore.get();
+ }
rgw::sal::Driver* get_driver() {
return env.driver;
}
void init_frontends1(bool nfs = false);
void init_numa();
- void init_storage();
+ int init_storage();
void init_perfcounters();
void init_http_clients();
void cond_init_apis();
class OpsLogSink;
class RGWREST;
+namespace rgw {
+ class SiteConfig;
+}
namespace rgw::auth {
class StrategyRegistry;
}
class Background;
}
namespace rgw::sal {
- class Store;
+ class ConfigStore;
+ class Driver;
class LuaManager;
}
struct RGWProcessEnv {
RGWLuaProcessEnv lua;
+ rgw::sal::ConfigStore* cfgstore = nullptr;
rgw::sal::Driver* driver = nullptr;
+ rgw::SiteConfig* site = nullptr;
RGWREST *rest = nullptr;
OpsLogSink *olog = nullptr;
std::unique_ptr<rgw::auth::StrategyRegistry> auth_registry;