Mod, // rjenkins hash of object name, modulo num_shards
};
-inline std::ostream& operator<<(std::ostream& out, const rgw::BucketIndexType &index_type)
+inline std::ostream& operator<<(std::ostream& out, const BucketIndexType &index_type)
{
switch (index_type) {
- case rgw::BucketIndexType::Normal:
+ case BucketIndexType::Normal:
return out << "Normal";
- case rgw::BucketIndexType::Indexless:
+ case BucketIndexType::Indexless:
return out << "Indexless";
default:
return out << "Unknown";
return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 1, obj_size);
}
-int RGWRados::get_target_shard_id(const RGWBucketInfo& bucket_info, const string& obj_key,
+int RGWRados::get_target_shard_id(const rgw::bucket_index_normal_layout& layout, const string& obj_key,
int *shard_id)
{
int r = 0;
- switch (bucket_info.layout.current_index.layout.normal.hash_type) {
+ switch (layout.hash_type) {
case rgw::BucketHashType::Mod:
- if (!bucket_info.layout.current_index.layout.normal.num_shards) {
+ if (!layout.num_shards) {
if (shard_id) {
*shard_id = -1;
}
} else {
- uint32_t sid = svc.bi_rados->bucket_shard_index(obj_key, bucket_info.layout.current_index.layout.normal.num_shards);
+ uint32_t sid = svc.bi_rados->bucket_shard_index(obj_key, layout.num_shards);
if (shard_id) {
*shard_id = (int)sid;
}
uint64_t end_epoch);
int cls_obj_usage_log_clear(string& oid);
- int get_target_shard_id(const RGWBucketInfo& bucket_info, const string& obj_key, int *shard_id);
+ int get_target_shard_id(const rgw::bucket_index_normal_layout& layout, const string& obj_key, int *shard_id);
int lock_exclusive(const rgw_pool& pool, const string& oid, ceph::timespan& duration, rgw_zone_id& zone_id, string& owner_id);
int unlock(const rgw_pool& pool, const string& oid, rgw_zone_id& zone_id, string& owner_id);
Formatter *formatter)
{
rgw_bucket& bucket = bucket_info.bucket;
+ rgw::bucket_index_normal_layout layout;
int ret = 0;
// place the multipart .meta object on the same shard as its head object
obj.index_hash_source = mp.get_key();
}
- int ret = store->getRados()->get_target_shard_id(new_bucket_info, obj.get_hash_object(), &target_shard_id);
+ int ret = store->getRados()->get_target_shard_id(layout, obj.get_hash_object(), &target_shard_id);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: get_target_shard_id() returned ret=" << ret << dendl;
return ret;