return ret;
}
-int RGWRados::init_svc(bool raw, const DoutPrefixProvider *dpp)
+int RGWRados::init_svc(bool raw, const DoutPrefixProvider *dpp,
+ const rgw::SiteConfig& site)
{
if (raw) {
- return svc.init_raw(cct, driver, use_cache, null_yield, dpp);
+ return svc.init_raw(cct, driver, use_cache, null_yield, dpp, site);
}
- return svc.init(cct, driver, use_cache, run_sync_thread, null_yield, dpp);
-}
-
-int RGWRados::init_ctl(const DoutPrefixProvider *dpp)
-{
- return ctl.init(&svc, driver, dpp);
+ return svc.init(cct, driver, use_cache, run_sync_thread, null_yield, dpp, site);
}
/**
* Initialize the RADOS instance and prepare to do other ops
* Returns 0 on success, -ERR# on failure.
*/
-int RGWRados::init_begin(const DoutPrefixProvider *dpp)
+int RGWRados::init_begin(CephContext* _cct, const DoutPrefixProvider *dpp,
+ const rgw::SiteConfig& site)
{
- int ret;
-
- ret = driver->init_neorados(dpp);
+ set_context(_cct);
+ int ret = driver->init_neorados(dpp);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to initialize neorados (ret=" << cpp_strerror(-ret) << ")" << dendl;
return ret;
return ret;
}
- ret = init_svc(false, dpp);
+ ret = init_svc(false, dpp, site);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl;
return ret;
}
- ret = init_ctl(dpp);
+ ret = ctl.init(&svc, driver, dpp);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to init ctls (ret=" << cpp_strerror(-ret) << ")" << dendl;
return ret;
struct RGWZoneParams;
class RGWReshard;
class RGWReshardWait;
+namespace rgw { class SiteConfig; }
struct get_obj_data;
CephContext *ctx() { return cct; }
/** do all necessary setup of the storage device */
- int init_begin(CephContext *_cct, const DoutPrefixProvider *dpp) {
- set_context(_cct);
- return init_begin(dpp);
- }
+ int init_begin(CephContext *_cct, const DoutPrefixProvider *dpp,
+ const rgw::SiteConfig& site);
/** Initialize the RADOS instance and prepare to do other ops */
- int init_svc(bool raw, const DoutPrefixProvider *dpp);
- int init_ctl(const DoutPrefixProvider *dpp);
+ int init_svc(bool raw, const DoutPrefixProvider *dpp, const rgw::SiteConfig& site);
virtual int init_rados();
- int init_begin(const DoutPrefixProvider *dpp);
int init_complete(const DoutPrefixProvider *dpp, optional_yield y);
void finalize();
extern "C" {
-void* newRadosStore(void* io_context, const void* site_config)
+void* newRadosStore(void* io_context)
{
rgw::sal::RadosStore* store = new rgw::sal::RadosStore(
- *static_cast<boost::asio::io_context*>(io_context),
- *static_cast<const rgw::SiteConfig*>(site_config));
+ *static_cast<boost::asio::io_context*>(io_context));
if (store) {
RGWRados* rados = new RGWRados();
class RadosStore : public StoreDriver {
private:
boost::asio::io_context& io_context;
- const rgw::SiteConfig& site_config;
RGWRados* rados;
RGWUserCtl* user_ctl;
std::unique_ptr<RadosZone> zone;
std::string topics_oid(const std::string& tenant) const;
public:
- RadosStore(boost::asio::io_context& io_context,
- const rgw::SiteConfig& site_config)
- : io_context(io_context), site_config(site_config), rados(nullptr) {
+ RadosStore(boost::asio::io_context& io_context)
+ : io_context(io_context), rados(nullptr) {
}
~RadosStore() {
delete rados;
void setRados(RGWRados * st) { rados = st; }
RGWRados* getRados(void) { return rados; }
boost::asio::io_context& get_io_context() { return io_context; }
- const rgw::SiteConfig& get_siteconfig() { return site_config; }
neorados::RADOS& get_neorados() { return *neorados; }
RGWServices* svc() { return &rados->svc; }
has_shutdown = true;
}
-int RGWServices::do_init(CephContext *_cct, rgw::sal::RadosStore* driver, bool have_cache, bool raw, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp)
+int RGWServices::do_init(CephContext *_cct, rgw::sal::RadosStore* driver, bool have_cache, bool raw, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp, const rgw::SiteConfig& _site)
{
cct = _cct;
+ site = &_site;
int r = _svc.init(cct, driver, have_cache, raw, run_sync, y, dpp);
if (r < 0) {
void shutdown();
};
+namespace rgw { class SiteConfig; }
struct RGWServices
{
RGWServices_Def _svc;
CephContext *cct;
+ const rgw::SiteConfig* site{nullptr};
RGWSI_Finisher *finisher{nullptr};
RGWSI_Bucket *bucket{nullptr};
int do_init(CephContext *cct, rgw::sal::RadosStore* store, bool have_cache,
bool raw_storage, bool run_sync, optional_yield y,
- const DoutPrefixProvider *dpp);
+ const DoutPrefixProvider *dpp, const rgw::SiteConfig& site);
int init(CephContext *cct, rgw::sal::RadosStore* store, bool have_cache,
- bool run_sync, optional_yield y, const DoutPrefixProvider *dpp) {
- return do_init(cct, store, have_cache, false, run_sync, y, dpp);
+ bool run_sync, optional_yield y, const DoutPrefixProvider *dpp,
+ const rgw::SiteConfig& site) {
+ return do_init(cct, store, have_cache, false, run_sync, y, dpp, site);
}
int init_raw(CephContext *cct, rgw::sal::RadosStore* store,
bool have_cache, optional_yield y,
- const DoutPrefixProvider *dpp) {
- return do_init(cct, store, have_cache, true, false, y, dpp);
+ const DoutPrefixProvider *dpp,
+ const rgw::SiteConfig& site) {
+ return do_init(cct, store, have_cache, true, false, y, dpp, site);
}
void shutdown() {
_svc.shutdown();
#define dout_subsys ceph_subsys_rgw
extern "C" {
-extern rgw::sal::Driver* newRadosStore(boost::asio::io_context* io_context,
- const rgw::SiteConfig* site_config);
+extern rgw::sal::Driver* newRadosStore(boost::asio::io_context* io_context);
#ifdef WITH_RADOSGW_DBSTORE
extern rgw::sal::Driver* newDBStore(CephContext *cct);
#endif
rgw::sal::Driver* driver{nullptr};
if (cfg.store_name.compare("rados") == 0) {
- driver = newRadosStore(&io_context, &site_config);
+ driver = newRadosStore(&io_context);
RGWRados* rados = static_cast<rgw::sal::RadosStore* >(driver)->getRados();
if ((*rados).set_use_cache(use_cache)
.set_run_sync_thread(run_sync_thread)
.set_run_reshard_thread(run_reshard_thread)
.set_run_notification_thread(run_notification_thread)
- .init_begin(cct, dpp) < 0) {
+ .init_begin(cct, dpp, site_config) < 0) {
delete driver;
return nullptr;
}
}
}
else if (cfg.store_name.compare("d3n") == 0) {
- driver = new rgw::sal::RadosStore(io_context, site_config);
+ driver = new rgw::sal::RadosStore(io_context);
RGWRados* rados = new D3nRGWDataCache<RGWRados>;
dynamic_cast<rgw::sal::RadosStore*>(driver)->setRados(rados);
rados->set_store(static_cast<rgw::sal::RadosStore* >(driver));
.set_run_sync_thread(run_sync_thread)
.set_run_reshard_thread(run_reshard_thread)
.set_run_notification_thread(run_notification_thread)
- .init_begin(cct, dpp) < 0) {
+ .init_begin(cct, dpp, site_config) < 0) {
delete driver;
return nullptr;
}
{
rgw::sal::Driver* driver = nullptr;
if (cfg.store_name.compare("rados") == 0) {
- driver = newRadosStore(&io_context, &site_config);
+ driver = newRadosStore(&io_context);
RGWRados* rados = static_cast<rgw::sal::RadosStore* >(driver)->getRados();
rados->set_context(cct);
return nullptr;
}
- int ret = rados->init_svc(true, dpp);
+ int ret = rados->init_svc(true, dpp, site_config);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl;
delete driver;
// Unfortunately RGWCivetWeb is too tightly tied to civetweb to test RGWCivetWeb::init_env.
RGWEnv rgw_env;
ceph::async::io_context_pool context_pool(cct->_conf->rgw_thread_pool_size); \
- auto site = rgw::SiteConfig::make_fake();
- rgw::sal::RadosStore store(context_pool, *site);
+ rgw::sal::RadosStore store(context_pool);
std::unique_ptr<rgw::sal::User> user = store.get_user(rgw_user());
rgw_env.set("REMOTE_ADDR", "192.168.1.1");
rgw_env.set("HTTP_HOST", "1.2.3.4");
#include "rgw_lua_request.h"
#include "rgw_lua_background.h"
#include "rgw_lua_data_filter.h"
-#include "driver/rados/rgw_zone.h"
#include "rgw_sal_config.h"
using namespace std;
inline std::unique_ptr<sal::RadosStore> make_store() {
auto context_pool = std::make_unique<ceph::async::io_context_pool>(
g_cct->_conf->rgw_thread_pool_size);
- std::unique_ptr<rgw::SiteConfig> site = rgw::SiteConfig::make_fake();
-
struct StoreBundle : public sal::RadosStore {
std::unique_ptr<ceph::async::io_context_pool> context_pool;
- std::unique_ptr<rgw::SiteConfig> site;
- StoreBundle(std::unique_ptr<ceph::async::io_context_pool> context_pool_,
- std::unique_ptr<rgw::SiteConfig> site_)
- : sal::RadosStore(*context_pool_.get(), *site_),
- context_pool(std::move(context_pool_)),
- site(std::move(site_)) {
+ StoreBundle(std::unique_ptr<ceph::async::io_context_pool> context_pool_)
+ : sal::RadosStore(*context_pool_.get()),
+ context_pool(std::move(context_pool_)) {
setRados(new RGWRados);
}
virtual ~StoreBundle() = default;
};
- return std::make_unique<StoreBundle>(std::move(context_pool),
- std::move(site));
+ return std::make_unique<StoreBundle>(std::move(context_pool));
};
#define DEFINE_REQ_STATE RGWProcessEnv pe; \