} while (user_buckets.is_truncated());
}
-// note: function type conforms to RGWRados::check_filter_t
-bool rgw_bucket_object_check_filter(const string& oid)
+// returns true if entry is in the empty namespace. note: function
+// type conforms to type RGWBucketListNameFilter
+bool rgw_bucket_object_check_filter(const std::string& oid)
{
- rgw_obj_key key;
- string ns;
- return rgw_obj_key::oid_to_key_in_ns(oid, &key, ns);
+ const static std::string empty_ns;
+ rgw_obj_key key; // thrown away but needed for parsing
+ return rgw_obj_key::oid_to_key_in_ns(oid, &key, empty_ns);
}
int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::Store* store, rgw::sal::Bucket* bucket, rgw_obj_key& key)
while (results.is_truncated) {
rgw::sal::Bucket::ListParams params;
params.marker = results.next_marker;
+ params.force_check_filter = rgw_bucket_object_check_filter;
int r = bucket->list(dpp, params, listing_max_entries, results, y);
std::string &tenant_name, std::string &bucket_name);
// this is used as a filter to RGWRados::cls_bucket_list_ordered; it
-// conforms to the type declaration of RGWRados::check_filter_t.
+// conforms to the type RGWBucketListNameFilter
extern bool rgw_bucket_object_check_filter(const std::string& oid);
void init_default_bucket_layout(CephContext *cct, rgw::BucketLayout& layout,
* operating on one shard at a time */
params.allow_unordered = true;
params.ns = RGW_OBJ_NS_MULTIPART;
- params.filter = &mp_filter;
+ params.access_list_filter = &mp_filter;
auto pf = [&](RGWLC::LCWorker* wk, WorkQ* wq, WorkItem& wi) {
auto wt = boost::get<std::tuple<lc_op, rgw_bucket_dir_entry>>(wi);
#define RGW_USAGE_OBJ_PREFIX "usage."
+// returns true on success, false on failure
static bool rgw_get_obj_data_pool(const RGWZoneGroup& zonegroup, const RGWZoneParams& zone_params,
const rgw_placement_rule& head_placement_rule,
const rgw_obj& obj, rgw_pool *pool)
&truncated,
&cls_filtered,
&cur_marker,
- y);
+ y,
+ params.force_check_filter);
if (r < 0) {
return r;
}
next_marker = index_key;
}
- if (params.filter &&
- ! params.filter->filter(obj.name, index_key.name)) {
+ if (params.access_list_filter &&
+ ! params.access_list_filter->filter(obj.name, index_key.name)) {
continue;
}
continue;
}
- if (params.filter && !params.filter->filter(obj.name, index_key.name))
+ if (params.access_list_filter &&
+ !params.access_list_filter->filter(obj.name, index_key.name)) {
continue;
+ }
if (params.prefix.size() &&
- (0 != obj.name.compare(0, params.prefix.size(), params.prefix)))
+ (0 != obj.name.compare(0, params.prefix.size(), params.prefix))) {
continue;
+ }
if (count >= max) {
truncated = true;
return -ENOENT;
}
+// returns true on success, false on failure
bool RGWRados::get_obj_data_pool(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_pool *pool)
{
return rgw_get_obj_data_pool(svc.zone->get_zonegroup(), svc.zone->get_zone_params(), placement_rule, obj, pool);
bool* cls_filtered,
rgw_obj_index_key *last_entry,
optional_yield y,
- check_filter_t force_check_filter)
+ RGWBucketListNameFilter force_check_filter)
{
/* expansion_factor allows the number of entries to read to grow
* exponentially; this is used when earlier reads are producing too
bool *is_truncated,
rgw_obj_index_key *last_entry,
optional_yield y,
- check_filter_t force_check_filter) {
+ RGWBucketListNameFilter force_check_filter) {
ldpp_dout(dpp, 10) << __func__ << " " << bucket_info.bucket <<
" start_after=\"" << start_after <<
"\", prefix=\"" << prefix <<
list_state.meta.category = main_category;
list_state.meta.etag = etag;
list_state.meta.content_type = content_type;
- if (astate->obj_tag.length() > 0)
+
+ if (astate->obj_tag.length() > 0) {
list_state.tag = astate->obj_tag.c_str();
+ }
+
list_state.meta.owner = owner.get_id().to_str();
list_state.meta.owner_display_name = owner.get_display_name();
list_state.exists = true;
+
cls_rgw_encode_suggestion(CEPH_RGW_UPDATE | suggest_flag, list_state, suggested_updates);
return 0;
}
rgw_obj_key end_marker;
std::string ns;
bool enforce_ns;
- RGWAccessListFilter *filter;
+ RGWAccessListFilter* access_list_filter;
+ RGWBucketListNameFilter force_check_filter;
bool list_versions;
bool allow_unordered;
Params() :
enforce_ns(true),
- filter(NULL),
+ access_list_filter(nullptr),
list_versions(false),
allow_unordered(false)
{}
using ent_map_t =
boost::container::flat_map<std::string, rgw_bucket_dir_entry>;
- using check_filter_t = bool (*)(const std::string&);
-
int cls_bucket_list_ordered(const DoutPrefixProvider *dpp,
RGWBucketInfo& bucket_info,
const int shard_id,
bool* cls_filtered,
rgw_obj_index_key *last_entry,
optional_yield y,
- check_filter_t force_check_filter = nullptr);
+ RGWBucketListNameFilter force_check_filter = {});
int cls_bucket_list_unordered(const DoutPrefixProvider *dpp,
RGWBucketInfo& bucket_info,
int shard_id,
bool *is_truncated,
rgw_obj_index_key *last_entry,
optional_yield y,
- check_filter_t = nullptr);
+ RGWBucketListNameFilter force_check_filter = {});
int cls_bucket_head(const DoutPrefixProvider *dpp,
const RGWBucketInfo& bucket_info,
int shard_id,
typedef std::shared_ptr<RGWSyncModuleInstance> RGWSyncModuleInstanceRef;
class RGWCompressionInfo;
+
+using RGWBucketListNameFilter = std::function<bool (const std::string&)>;
+
+
namespace rgw {
class Aio;
namespace IAM { struct Policy; }
rgw_obj_key end_marker;
std::string ns;
bool enforce_ns{true};
- RGWAccessListFilter* filter{nullptr};
+ RGWAccessListFilter* access_list_filter{nullptr};
+ RGWBucketListNameFilter force_check_filter;
bool list_versions{false};
bool allow_unordered{false};
int shard_id{RGW_NO_SHARD};
list_op.params.end_marker = params.end_marker;
list_op.params.ns = params.ns;
list_op.params.enforce_ns = params.enforce_ns;
- list_op.params.filter = params.filter;
+ list_op.params.access_list_filter = params.access_list_filter;
+ list_op.params.force_check_filter = params.force_check_filter;
list_op.params.list_versions = params.list_versions;
list_op.params.allow_unordered = params.allow_unordered;
list_op.params.end_marker = params.end_marker;
list_op.params.ns = params.ns;
list_op.params.enforce_ns = params.enforce_ns;
- list_op.params.filter = params.filter;
+ list_op.params.access_list_filter = params.access_list_filter;
+ list_op.params.force_check_filter = params.force_check_filter;
list_op.params.list_versions = params.list_versions;
list_op.params.allow_unordered = params.allow_unordered;
params.delim = delim;
params.marker = marker;
params.ns = RGW_OBJ_NS_MULTIPART;
- params.filter = &mp_filter;
+ params.access_list_filter = &mp_filter;
int ret = list(dpp, params, max_uploads, results, null_yield);
rgw_obj_key end_marker;
string ns;
bool enforce_ns;
- RGWAccessListFilter *filter;
+ RGWAccessListFilter* access_list_filter;
+ RGWBucketListNameFilter force_check_filter;
bool list_versions;
- bool allow_unordered;
+ bool allow_unordered;
Params() :
enforce_ns(true),
- filter(NULL),
+ access_list_filter(nullptr),
list_versions(false),
allow_unordered(false)
{}