}
JSONFormattable& get_tier_config(RGWRados *store) {
- return store->get_zone_params().tier_config;
+ return store->svc.zone->get_zone_params().tier_config;
}
const string& get_tier_type(RGWRados *store) {
- return store->get_zone().tier_type;
+ return store->svc.zone->get_zone().tier_type;
}
int main(int argc, const char **argv)
#include "rgw_user.h"
#include "rgw_op.h"
#include "rgw_acl_s3.h"
+#include "rgw_zone.h"
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_rgw
template<>
int RGWGetBucketInfoCR::Request::_send_request()
{
- RGWObjectCtx obj_ctx(store);
+ RGWSysObjectCtx obj_ctx(store->svc.sysobj->init_obj_ctx());
return store->get_bucket_info(obj_ctx, params.tenant, params.bucket_name,
result->bucket_info, &result->mtime, &result->attrs);
}
int RGWBucketCreateLocalCR::Request::_send_request()
{
CephContext *cct = store->ctx();
+ auto& zone_svc = store->svc.zone;
+ auto& sysobj_svc = store->svc.sysobj;
const auto& user_info = params.user_info.get();
const auto& user = user_info->user_id;
const auto& bucket_name = params.bucket_name;
auto& placement_rule = params.placement_rule;
- const auto& zonegroup = store->get_zonegroup();
+ const auto& zonegroup = zone_svc->get_zonegroup();
if (!placement_rule.empty() &&
!zonegroup.placement_targets.count(placement_rule)) {
ldout(cct, 0) << "placement target (" << placement_rule << ")"
<< " doesn't exist in the placement targets of zonegroup"
- << " (" << store->get_zonegroup().api_name << ")" << dendl;
+ << " (" << zone_svc->get_zonegroup().api_name << ")" << dendl;
return -ERR_INVALID_LOCATION_CONSTRAINT;
}
/* we need to make sure we read bucket info, it's not read before for this
* specific request */
- RGWObjectCtx obj_ctx(store);
+ RGWSysObjectCtx sysobj_ctx(sysobj_svc->init_obj_ctx());
RGWBucketInfo bucket_info;
map<string, bufferlist> bucket_attrs;
- int ret = store->get_bucket_info(obj_ctx, user.tenant, bucket_name,
+ int ret = store->get_bucket_info(sysobj_ctx, user.tenant, bucket_name,
bucket_info, nullptr, &bucket_attrs);
if (ret < 0 && ret != -ENOENT)
return ret;
uint32_t *pmaster_num_shards = nullptr;
real_time creation_time;
- string zonegroup_id = store->get_zonegroup().get_id();
+ string zonegroup_id = zone_svc->get_zonegroup().get_id();
if (bucket_exists) {
string selected_placement_rule;
rgw_bucket bucket;
bucket.tenant = user.tenant;
bucket.name = bucket_name;
- ret = store->select_bucket_placement(*user_info, zonegroup_id,
+ ret = zone_svc->select_bucket_placement(*user_info, zonegroup_id,
placement_rule,
&selected_placement_rule, nullptr);
if (selected_placement_rule != bucket_info.placement_rule) {
RGWBucketInfo bucket_info;
string tenant;
- RGWObjectCtx obj_ctx(store);
+ RGWSysObjectCtx obj_ctx(store->svc.sysobj->init_obj_ctx());
ret = store->get_bucket_info(obj_ctx, tenant, sub_conf.dest.bucket_name, bucket_info, nullptr, nullptr);
if (ret == -ENOENT) {
result->is_truncated = false;
RGWBucketInfo bucket_info;
string tenant;
- RGWObjectCtx obj_ctx(store);
- ret = store->get_bucket_info(obj_ctx, tenant, sub_conf.dest.bucket_name, bucket_info, nullptr, nullptr);
+ RGWSysObjectCtx sysobj_ctx(store->svc.sysobj->init_obj_ctx());
+ ret = store->get_bucket_info(sysobj_ctx, tenant, sub_conf.dest.bucket_name, bucket_info, nullptr, nullptr);
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: failed to read bucket info for events bucket: bucket=" << sub_conf.dest.bucket_name << " ret=" << ret << dendl;
return ret;
rgw_bucket& bucket = bucket_info.bucket;
+ RGWObjectCtx obj_ctx(store);
rgw_obj obj(bucket, event_id);
- obj_ctx.obj.set_atomic(obj);
+ obj_ctx.set_atomic(obj);
RGWRados::Object del_target(store, bucket_info, obj_ctx, obj);
RGWRados::Object::Delete del_op(&del_target);
#include "rgw_common.h"
#include "rgw_tools.h"
+#include "rgw_zone.h"
+
+#include "services/svc_sys_obj.h"
struct rgw_pubsub_event {
RGWRados *store;
rgw_user user;
- RGWObjectCtx obj_ctx;
+ RGWSysObjectCtx obj_ctx;
rgw_raw_obj user_meta_obj;
public:
RGWUserPubSub(RGWRados *_store, const rgw_user& _user) : store(_store),
user(_user),
- obj_ctx(store) {
+ obj_ctx(store->svc.sysobj->init_obj_ctx()) {
get_user_meta_obj(&user_meta_obj);
}
}
void get_user_meta_obj(rgw_raw_obj *obj) const {
- *obj = rgw_raw_obj(store->get_zone_params().log_pool, user_meta_oid());
+ *obj = rgw_raw_obj(store->svc.zone->get_zone_params().log_pool, user_meta_oid());
}
void get_bucket_meta_obj(const rgw_bucket& bucket, rgw_raw_obj *obj) const {
- *obj = rgw_raw_obj(store->get_zone_params().log_pool, bucket_meta_oid(bucket));
+ *obj = rgw_raw_obj(store->svc.zone->get_zone_params().log_pool, bucket_meta_oid(bucket));
}
void get_sub_meta_obj(const string& name, rgw_raw_obj *obj) const {
- *obj = rgw_raw_obj(store->get_zone_params().log_pool, sub_meta_oid(name));
+ *obj = rgw_raw_obj(store->svc.zone->get_zone_params().log_pool, sub_meta_oid(name));
}
int get_user_topics(rgw_pubsub_user_topics *result);
string addr;
if (split_endpoint(sub_conf->push_endpoint, &addr, &sub->push.path)) {
list<string> endpoints{addr};
- sub->push.conn = std::make_shared<RGWRESTConn>(sync_env->cct, sync_env->store, remote_id, endpoints);
+ sub->push.conn = std::make_shared<RGWRESTConn>(sync_env->cct, sync_env->store->svc.zone, remote_id, endpoints);
} else {
ldout(sync_env->cct, 20) << "failed to split push endpoint: " << sub_conf->push_endpoint << dendl;
}
rgw_raw_obj obj;
ups.get_sub_meta_obj(sub_name, &obj);
bool empty_on_enoent = false;
- call(new ReadInfoCR(sync_env->async_rados, sync_env->store,
+ call(new ReadInfoCR(sync_env->async_rados, sync_env->store->svc.sysobj,
obj,
&user_sub_conf, empty_on_enoent));
}
using ReadInfoCR = RGWSimpleRadosReadCR<rgw_pubsub_bucket_topics>;
yield {
bool empty_on_enoent = true;
- call(new ReadInfoCR(sync_env->async_rados, sync_env->store,
+ call(new ReadInfoCR(sync_env->async_rados, sync_env->store->svc.sysobj,
bucket_obj,
&bucket_topics, empty_on_enoent));
}
using ReadUserTopicsInfoCR = RGWSimpleRadosReadCR<rgw_pubsub_user_topics>;
yield {
bool empty_on_enoent = true;
- call(new ReadUserTopicsInfoCR(sync_env->async_rados, sync_env->store,
+ call(new ReadUserTopicsInfoCR(sync_env->async_rados, sync_env->store->svc.sysobj,
user_obj,
&user_topics, empty_on_enoent));
}
void init(RGWDataSyncEnv *sync_env, uint64_t instance_id) override {
PSManagerRef mgr = PSManager::get_shared(sync_env, env);
- env->init_instance(sync_env->store->get_realm(), instance_id, mgr);
+ env->init_instance(sync_env->store->svc.zone->get_realm(), instance_id, mgr);
}
RGWCoroutine *start_sync(RGWDataSyncEnv *sync_env) override {
return ret;
}
- RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-
- ret = store->get_bucket_info(obj_ctx, s->owner.get_id().tenant, bucket_name,
+ ret = store->get_bucket_info(*s->sysobj_ctx, s->owner.get_id().tenant, bucket_name,
bucket_info, nullptr, nullptr);
if (ret < 0) {
return ret;
return ret;
}
- RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-
- ret = store->get_bucket_info(obj_ctx, s->owner.get_id().tenant, bucket_name,
+ ret = store->get_bucket_info(*s->sysobj_ctx, s->owner.get_id().tenant, bucket_name,
bucket_info, nullptr, nullptr);
if (ret < 0) {
return ret;
return ret;
}
- RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-
- ret = store->get_bucket_info(obj_ctx, s->owner.get_id().tenant, bucket_name,
+ ret = store->get_bucket_info(*s->sysobj_ctx, s->owner.get_id().tenant, bucket_name,
bucket_info, nullptr, nullptr);
if (ret < 0) {
return ret;
#include "rgw_putobj_processor.h"
#include "rgw_aio_throttle.h"
#include "rgw_compression.h"
+#include "rgw_zone.h"
#include "services/svc_sys_obj.h"
+#include "services/svc_zone_utils.h"
#define dout_subsys ceph_subsys_rgw
#define dout_context g_ceph_context
RGWDataAccess::RGWDataAccess(RGWRados *_store) : store(_store)
{
- obj_ctx = std::make_unique<RGWObjectCtx>(store);
+ sysobj_ctx = std::make_unique<RGWSysObjectCtx>(store->svc.sysobj->init_obj_ctx());
}
int RGWDataAccess::Bucket::init()
{
- int ret = sd->store->get_bucket_info(*sd->obj_ctx,
+ int ret = sd->store->get_bucket_info(*sd->sysobj_ctx,
tenant, name,
bucket_info,
&mtime,
auto& owner = bucket->policy.get_owner();
- string req_id = store->unique_id(store->get_new_req_id());
+ string req_id = store->svc.zone_utils->unique_id(store->get_new_req_id());
AtomicObjectProcessor processor(&aio, store, bucket_info,
owner.get_id(),
CompressorRef plugin;
boost::optional<RGWPutObj_Compress> compressor;
- const auto& compression_type = store->get_zone_params().get_compression_type(bucket_info.placement_rule);
+ const auto& compression_type = store->svc.zone->get_zone_params().get_compression_type(bucket_info.placement_rule);
if (compression_type != "none") {
plugin = Compressor::create(store->ctx(), compression_type);
if (!plugin) {
void RGWDataAccess::Object::set_policy(const RGWAccessControlPolicy& policy)
{
policy.encode(aclbl.emplace());
+}
+
int rgw_tools_init(CephContext *cct)
{
ext_mime_map = new std::map<std::string, std::string>;
class RGWDataAccess
{
RGWRados *store;
- std::unique_ptr<RGWObjectCtx> obj_ctx;
+ std::unique_ptr<RGWSysObjectCtx> sysobj_ctx;
public:
RGWDataAccess(RGWRados *_store);
std::string name;
set<std::string> tags;
- bool user_permitted(list<std::string>& user_tags) const {
+ bool user_permitted(const list<std::string>& user_tags) const {
if (tags.empty()) {
return true;
}
}
-int RGWSI_Zone::select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_id, const string& request_rule,
+int RGWSI_Zone::select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id, const string& request_rule,
string *pselected_rule_name, RGWZonePlacementInfo *rule_info)
{
return 0;
}
-int RGWSI_Zone::select_bucket_placement(RGWUserInfo& user_info, const string& zonegroup_id, const string& placement_rule,
+int RGWSI_Zone::select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id, const string& placement_rule,
string *pselected_rule_name, RGWZonePlacementInfo *rule_info)
{
if (!get_zone_params().placement_pools.empty()) {
RGWRESTConn *get_zone_conn_by_name(const string& name);
bool find_zone_id_by_name(const string& name, string *id);
- int select_bucket_placement(RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
+ int select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
string *pselected_rule_name, RGWZonePlacementInfo *rule_info);
int select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info);
- int select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
+ int select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
string *pselected_rule_name, RGWZonePlacementInfo *rule_info);
int select_bucket_location_by_rule(const string& location_rule, RGWZonePlacementInfo *rule_info);