- rados
- dbstore
- motr
+- name: rgw_filter
+ type: str
+ level: advanced
+ desc: experimental Option to set a filter
+ long_desc: defaults to none. Other valid values are base and trace (both experimental).
+ default: none
+ services:
+ - rgw
+ enum_values:
+ - none
+ - base
+ - trace
- name: dbstore_db_dir
type: str
level: advanced
}
#endif
+ // Get the filter
+ std::string rgw_filter = "none";
+ const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
+ if (config_filter == "base") {
+ rgw_filter = "base";
+ }
+
store = StoreManager::get_storage(this, g_ceph_context,
rgw_store,
+ rgw_filter,
run_gc,
run_lc,
run_quota,
}
#endif
+ // Get the filter
+ std::string rgw_filter = "none";
+ const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
+ if (config_filter == "base") {
+ rgw_filter = "base";
+ }
+
if (raw_storage_op) {
store = StoreManager::get_raw_storage(dpp(),
g_ceph_context,
- rgw_store);
+ rgw_store,
+ rgw_filter);
} else {
store = StoreManager::get_storage(dpp(),
g_ceph_context,
rgw_store,
+ rgw_filter,
false,
false,
false,
}
#endif
+ // Get the filter
+ std::string rgw_filter = "none";
+ const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
+ if (config_filter == "base") {
+ rgw_filter = "base";
+ }
+
rgw::sal::Store* store =
StoreManager::get_storage(&dp, g_ceph_context,
rgw_store,
+ rgw_filter,
g_conf()->rgw_enable_gc_threads,
g_conf()->rgw_enable_lc_threads,
g_conf()->rgw_enable_quota_threads,
common_init_finish(g_ceph_context);
const DoutPrefix dp(cct.get(), dout_subsys, "rgw object expirer: ");
- store = StoreManager::get_storage(&dp, g_ceph_context, "rados", false, false, false, false, false);
+ store = StoreManager::get_storage(&dp, g_ceph_context, "rados", "none", false, false, false, false, false);
if (!store) {
std::cerr << "couldn't init storage provider" << std::endl;
return EIO;
store =
StoreManager::get_storage(&dp, cct,
"rados",
+ "none",
cct->_conf->rgw_enable_gc_threads,
cct->_conf->rgw_enable_lc_threads,
cct->_conf->rgw_enable_quota_threads,
#ifdef WITH_RADOSGW_MOTR
extern rgw::sal::Store* newMotrStore(CephContext *cct);
#endif
+extern rgw::sal::Store* newBaseFilter(rgw::sal::Store* next);
}
RGWObjState::RGWObjState() {
compressed = rhs.compressed;
}
-rgw::sal::Store* StoreManager::init_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache, bool use_gc)
+rgw::sal::Store* StoreManager::init_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache, bool use_gc)
{
+ rgw::sal::Store* store{nullptr};
+
if (svc.compare("rados") == 0) {
- rgw::sal::Store* store = newStore();
+ store = newStore();
RGWRados* rados = static_cast<rgw::sal::RadosStore* >(store)->getRados();
if ((*rados).set_use_cache(use_cache)
delete store;
return nullptr;
}
- return store;
}
else if (svc.compare("d3n") == 0) {
- rgw::sal::RadosStore *store = new rgw::sal::RadosStore();
+ store = new rgw::sal::RadosStore();
RGWRados* rados = new D3nRGWDataCache<RGWRados>;
- store->setRados(rados);
+ dynamic_cast<rgw::sal::RadosStore*>(store)->setRados(rados);
rados->set_store(static_cast<rgw::sal::RadosStore* >(store));
if ((*rados).set_use_cache(use_cache)
delete store;
return nullptr;
}
- return store;
}
-
#ifdef WITH_RADOSGW_DBSTORE
- if (svc.compare("dbstore") == 0) {
- rgw::sal::Store* store = newDBStore(cct);
+ else if (svc.compare("dbstore") == 0) {
+ store = newDBStore(cct);
if ((*(rgw::sal::DBStore*)store).set_run_lc_thread(use_lc_thread)
.initialize(cct, dpp) < 0) {
delete store;
return nullptr;
}
-
- return store;
}
#endif
#ifdef WITH_RADOSGW_MOTR
- if (svc.compare("motr") == 0) {
- rgw::sal::Store* store = newMotrStore(cct);
+ else if (svc.compare("motr") == 0) {
+ store = newMotrStore(cct);
if (store == nullptr) {
ldpp_dout(dpp, 0) << "newMotrStore() failed!" << dendl;
return store;
ldpp_dout(dpp, 20) << "User display name = " << suser->get_info().display_name << dendl;
ldpp_dout(dpp, 20) << "User email = " << suser->get_info().user_email << dendl;
}
-
- return store;
}
#endif
- return nullptr;
+ if (filter.compare("base") == 0) {
+ rgw::sal::Store* next = store;
+ store = newBaseFilter(next);
+
+ if (store->initialize(cct, dpp) < 0) {
+ delete store;
+ delete next;
+ return nullptr;
+ }
+ }
+
+ return store;
}
-rgw::sal::Store* StoreManager::init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc)
+rgw::sal::Store* StoreManager::init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter)
{
rgw::sal::Store* store = nullptr;
if (svc.compare("rados") == 0) {
delete store;
return nullptr;
}
- }
-
- if (svc.compare("dbstore") == 0) {
+ } else if (svc.compare("dbstore") == 0) {
#ifdef WITH_RADOSGW_DBSTORE
store = newDBStore(cct);
delete store;
return nullptr;
}
-
#else
store = nullptr;
#endif
- }
-
- if (svc.compare("motr") == 0) {
+ } else if (svc.compare("motr") == 0) {
#ifdef WITH_RADOSGW_MOTR
store = newMotrStore(cct);
#else
store = nullptr;
#endif
}
+
+ if (filter.compare("base") == 0) {
+ rgw::sal::Store* next = store;
+ store = newBaseFilter(next);
+
+ if (store->initialize(cct, dpp) < 0) {
+ delete store;
+ delete next;
+ return nullptr;
+ }
+ }
+
return store;
}
public:
StoreManager() {}
/** Get a full store by service name */
- static rgw::sal::Store* get_storage(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, bool use_gc_thread, bool use_lc_thread, bool quota_threads,
+ static rgw::sal::Store* get_storage(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter, bool use_gc_thread, bool use_lc_thread, bool quota_threads,
bool run_sync_thread, bool run_reshard_thread, bool use_cache = true, bool use_gc = true) {
- rgw::sal::Store* store = init_storage_provider(dpp, cct, svc, use_gc_thread, use_lc_thread,
+ rgw::sal::Store* store = init_storage_provider(dpp, cct, svc, filter, use_gc_thread, use_lc_thread,
quota_threads, run_sync_thread, run_reshard_thread, use_cache, use_gc);
return store;
}
/** Get a stripped down store by service name */
- static rgw::sal::Store* get_raw_storage(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc) {
- rgw::sal::Store* store = init_raw_storage_provider(dpp, cct, svc);
+ static rgw::sal::Store* get_raw_storage(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter) {
+ rgw::sal::Store* store = init_raw_storage_provider(dpp, cct, svc, filter);
return store;
}
/** Initialize a new full Store */
- static rgw::sal::Store* init_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache, bool use_gc);
+ static rgw::sal::Store* init_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache, bool use_gc);
/** Initialize a new raw Store */
- static rgw::sal::Store* init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc);
+ static rgw::sal::Store* init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter);
/** Close a Store when it's no longer needed */
static void close_storage(rgw::sal::Store* store);
}
} } // namespace rgw::sal
+
+extern "C" {
+
+rgw::sal::Store* newBaseFilter(rgw::sal::Store* next)
+{
+ rgw::sal::FilterStore* store = new rgw::sal::FilterStore(next);
+
+ return store;
+}
+
+}