Simply use the RADOS handle and `rgw_rados_ref` directly.
Also make `rgw::AccessListFilter` a std::function.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
rgw_obj_key end_marker;
std::string ns;
bool enforce_ns;
- RGWAccessListFilter* access_list_filter;
+ rgw::AccessListFilter access_list_filter;
RGWBucketListNameFilter force_check_filter;
bool list_versions;
bool allow_unordered;
Params() :
enforce_ns(true),
- access_list_filter(nullptr),
list_versions(false),
allow_unordered(false)
{}
}
if (params.access_list_filter &&
- ! params.access_list_filter->filter(obj.name, index_key.name)) {
+ !params.access_list_filter(obj.name, index_key.name)) {
ldpp_dout(dpp, 20) << __func__ <<
": skipping past namespaced objects, including \"" << entry.key <<
"\"" << dendl;
}
if (params.access_list_filter &&
- !params.access_list_filter->filter(obj.name, index_key.name)) {
+ !params.access_list_filter(obj.name, index_key.name)) {
ldpp_dout(dpp, 20) << __func__ <<
": skipping \"" << index_key <<
"\" because doesn't match filter" << dendl;
static int do_pool_iterate(const DoutPrefixProvider *dpp, CephContext* cct, RGWPoolIterCtx& ctx, uint32_t num,
vector<rgw_bucket_dir_entry>& objs,
- bool *is_truncated, RGWAccessListFilter *filter)
+ bool *is_truncated, const rgw::AccessListFilter& filter)
{
librados::IoCtx& io_ctx = ctx.io_ctx;
librados::NObjectIterator& iter = ctx.iter;
ldpp_dout(dpp, 20) << "RGWRados::pool_iterate: got " << oid << dendl;
// fill it in with initial values; we may correct later
- if (filter && !filter->filter(oid, oid))
+ if (filter && !filter(oid, oid))
continue;
e.key = oid;
}
int RGWRados::pool_iterate(const DoutPrefixProvider *dpp, RGWPoolIterCtx& ctx, uint32_t num, vector<rgw_bucket_dir_entry>& objs,
- bool *is_truncated, RGWAccessListFilter *filter)
+ bool *is_truncated, const rgw::AccessListFilter& filter)
{
// catch exceptions from NObjectIterator::operator++()
try {
if (!ctx.initialized) {
return -EINVAL;
}
- RGWAccessListFilterPrefix filter(prefix_filter);
+ auto filter = rgw::AccessListFilterPrefix(prefix_filter);
vector<rgw_bucket_dir_entry> objs;
- int r = pool_iterate(dpp, ctx.iter_ctx, max, objs, is_truncated, &filter);
+ int r = pool_iterate(dpp, ctx.iter_ctx, max, objs, is_truncated, filter);
if (r < 0) {
if(r != -ENOENT)
ldpp_dout(dpp, 10) << "failed to list objects pool_iterate returned r=" << r << dendl;
ldout_bitx(bitx, dpp, 25) << "BACKTRACE: " << __func__ << ": " << ClibBackTrace(0) << dendl_bitx;
ent_list.clear();
- static MultipartMetaFilter multipart_meta_filter;
*is_truncated = false;
librados::IoCtx index_pool;
rgw_obj obj(bucket_info.bucket, list_state.key);
- MultipartMetaFilter multipart_meta_filter;
string temp_key;
- if (multipart_meta_filter.filter(list_state.key.name, temp_key)) {
+ if (MultipartMetaFilter(list_state.key.name, temp_key)) {
obj.in_extra_data = true;
}
#include "rgw_cache.h"
#include "rgw_sal_fwd.h"
#include "rgw_pubsub.h"
+#include "rgw_tools.h"
struct D3nDataCache;
rgw_obj_key end_marker;
std::string ns;
bool enforce_ns;
- RGWAccessListFilter* access_list_filter;
+ rgw::AccessListFilter access_list_filter;
RGWBucketListNameFilter force_check_filter;
bool list_versions;
bool allow_unordered;
Params() :
enforce_ns(true),
- access_list_filter(nullptr),
list_versions(false),
allow_unordered(false)
{}
*/
int pool_iterate(const DoutPrefixProvider *dpp, RGWPoolIterCtx& ctx, uint32_t num,
std::vector<rgw_bucket_dir_entry>& objs,
- bool *is_truncated, RGWAccessListFilter *filter);
+ bool *is_truncated, const rgw::AccessListFilter& filter);
uint64_t next_bucket_id();
{
rgw::sal::Bucket::ListParams params;
rgw::sal::Bucket::ListResults results;
- MultipartMetaFilter mp_filter;
params.prefix = prefix;
params.delim = delim;
params.marker = marker;
params.ns = RGW_OBJ_NS_MULTIPART;
- params.access_list_filter = &mp_filter;
+ params.access_list_filter = MultipartMetaFilter;
int ret = list(dpp, params, max_uploads, results, y);
zone_utils->init(radoshandle, zone.get());
quota->init(zone.get());
sync_modules->init(zone.get());
- sysobj_core->core_init(rados.get(), zone.get());
+ sysobj_core->core_init(radoshandle, zone.get());
if (have_cache) {
- sysobj_cache->init(rados.get(), zone.get(), notify.get());
- sysobj->init(rados.get(), sysobj_cache.get());
+ sysobj_cache->init(radoshandle, zone.get(), notify.get());
+ sysobj->init(radoshandle, sysobj_cache.get());
} else {
- sysobj->init(rados.get(), sysobj_core.get());
+ sysobj->init(radoshandle, sysobj_core.get());
}
user_rados->init(radoshandle, zone.get(), sysobj.get(), sysobj_cache.get(),
meta.get(), meta_be_sobj.get(), sync_modules.get());
bufferlist inbl;
return h->mon_command(cmd, inbl, nullptr, nullptr);
}
+
+int rgw_list_pool(const DoutPrefixProvider *dpp,
+ librados::IoCtx& ioctx,
+ uint32_t max,
+ const rgw::AccessListFilter& filter,
+ std::string& marker,
+ std::vector<string> *oids,
+ bool *is_truncated)
+{
+ librados::ObjectCursor oc;
+ if (!oc.from_str(marker)) {
+ ldpp_dout(dpp, 10) << "failed to parse cursor: " << marker << dendl;
+ return -EINVAL;
+ }
+
+ auto iter = ioctx.nobjects_begin(oc);
+ /// Pool_iterate
+ if (iter == ioctx.nobjects_end())
+ return -ENOENT;
+
+ uint32_t i;
+
+ for (i = 0; i < max && iter != ioctx.nobjects_end(); ++i, ++iter) {
+ string oid = iter->get_oid();
+ ldpp_dout(dpp, 20) << "RGWRados::pool_iterate: got " << oid << dendl;
+
+ // fill it in with initial values; we may correct later
+ if (filter && !filter(oid, oid))
+ continue;
+
+ oids->push_back(oid);
+ }
+
+ marker = iter.get_cursor().to_str();
+ if (is_truncated)
+ *is_truncated = (iter != ioctx.nobjects_end());
+
+ return oids->size();
+}
#pragma once
+#include <functional>
#include <string>
+#include <string_view>
#include "include/types.h"
#include "include/ceph_hash.h"
bool rgw_check_secure_mon_conn(const DoutPrefixProvider *dpp);
int rgw_clog_warn(librados::Rados* h, const std::string& msg);
+
+int rgw_list_pool(const DoutPrefixProvider *dpp,
+ librados::IoCtx& ioctx,
+ uint32_t max,
+ const rgw::AccessListFilter& filter,
+ std::string& marker,
+ std::vector<std::string> *oids,
+ bool *is_truncated);
const multimap<string, lc_op>& prefix_map,
LCWorker* worker, time_t stop_at, bool once)
{
- MultipartMetaFilter mp_filter;
int ret;
rgw::sal::Bucket::ListParams params;
rgw::sal::Bucket::ListResults results;
* operating on one shard at a time */
params.allow_unordered = true;
params.ns = RGW_OBJ_NS_MULTIPART;
- params.access_list_filter = &mp_filter;
+ params.access_list_filter = MultipartMetaFilter;
const auto event_type = rgw::notify::ObjectExpirationAbortMPU;
return is_expired;
}
- int process(lc_op_ctx& oc) {
+ int process(lc_op_ctx& oc) override {
auto& o = oc.o;
int r;
if (o.is_delete_marker()) {
pass_object_lock_check(oc.driver, oc.obj.get(), dpp);
}
- int process(lc_op_ctx& oc) {
+ int process(lc_op_ctx& oc) override {
auto& o = oc.o;
int r = remove_expired_obj(oc.dpp, oc, true,
rgw::notify::ObjectExpirationNoncurrent);
return true;
}
- int process(lc_op_ctx& oc) {
+ int process(lc_op_ctx& oc) override {
auto& o = oc.o;
int r = remove_expired_obj(oc.dpp, oc, true,
rgw::notify::ObjectExpirationDeleteMarker);
return 0;
}
- int process(lc_op_ctx& oc) {
+ int process(lc_op_ctx& oc) override {
auto& o = oc.o;
int r;
public:
LCOpAction_CurrentTransition(const transition_action& _transition)
: LCOpAction_Transition(_transition) {}
- int process(lc_op_ctx& oc) {
+ int process(lc_op_ctx& oc) override {
int r = LCOpAction_Transition::process(oc);
if (r == 0) {
if (perfcounter) {
const transition_action& _transition)
: LCOpAction_Transition(_transition)
{}
- int process(lc_op_ctx& oc) {
+ int process(lc_op_ctx& oc) override {
int r = LCOpAction_Transition::process(oc);
if (r == 0) {
if (perfcounter) {
#include "svc_tier_rados.h"
-using namespace std;
-
const std::string MP_META_SUFFIX = ".meta";
-bool MultipartMetaFilter::filter(const string& name, string& key) {
+bool MultipartMetaFilter(const std::string& name, std::string& key) {
// the length of the suffix so we can skip past it
static const size_t MP_META_SUFFIX_LEN = MP_META_SUFFIX.length();
return false;
size_t pos = name.find(MP_META_SUFFIX, len - MP_META_SUFFIX_LEN);
- if (pos == string::npos)
+ if (pos == std::string::npos)
return false;
pos = name.rfind('.', pos - 1);
- if (pos == string::npos)
+ if (pos == std::string::npos)
return false;
key = name.substr(0, pos);
static void forward_req_info(const DoutPrefixProvider *dpp, CephContext *cct, req_info& info, const std::string& bucket_name);
-static MultipartMetaFilter mp_filter;
-
// this probably should belong in the rgw_iam_policy_keywords, I'll get it to it
// at some point
static constexpr auto S3_EXISTING_OBJTAG = "s3:ExistingObjectTag";
struct RGWBucketEnt;
class RGWRESTMgr;
-class RGWAccessListFilter;
class RGWLC;
struct rgw_user_bucket;
class RGWUsageBatch;
rgw_obj_key end_marker;
std::string ns;
bool enforce_ns{true};
- RGWAccessListFilter* access_list_filter{nullptr};
+ rgw::AccessListFilter access_list_filter{};
RGWBucketListNameFilter force_check_filter;
bool list_versions{false};
bool allow_unordered{false};
#pragma once
+#include <functional>
+#include <string>
-namespace rgw { namespace sal {
+namespace rgw {
+using AccessListFilter =
+ std::function<bool(const std::string&, std::string&)>;
+
+inline auto AccessListFilterPrefix(std::string prefix) {
+ return [prefix = std::move(prefix)](const std::string& name,
+ std::string& key) {
+ return (prefix.compare(key.substr(0, prefix.size())) == 0);
+ };
+}
+
+namespace sal {
class Driver;
class User;
librados::IoCtx& io_ctx,
librados::NObjectIterator& iter,
uint32_t num, vector<rgw_bucket_dir_entry>& objs,
- RGWAccessListFilter *filter,
+ const rgw::AccessListFilter& filter,
bool *is_truncated)
{
if (iter == io_ctx.nobjects_end())
ldpp_dout(dpp, 20) << "RGWRados::pool_iterate: got " << oid << dendl;
// fill it in with initial values; we may correct later
- if (filter && !filter->filter(oid, oid))
+ if (filter && filter(oid, oid))
continue;
e.key = oid;
return rados_svc->open_pool_ctx(dpp, pool, state.ioctx, params);
}
-int RGWSI_RADOS::Pool::List::init(const DoutPrefixProvider *dpp, const string& marker, RGWAccessListFilter *filter)
+int RGWSI_RADOS::Pool::List::init(const DoutPrefixProvider *dpp, const string& marker, rgw::AccessListFilter filter)
{
if (ctx.initialized) {
return -EINVAL;
try {
ctx.iter = ctx.ioctx.nobjects_begin(oc);
- ctx.filter = filter;
- ctx.initialized = true;
- return 0;
} catch (const std::system_error& e) {
r = -e.code().value();
ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what()
<< ", returning -5" << dendl;
return -EIO;
}
+ ctx.filter = std::move(filter);
+ ctx.initialized = true;
+
+ return 0;
}
int RGWSI_RADOS::Pool::List::get_next(const DoutPrefixProvider *dpp,
#include "include/rados/librados.hpp"
#include "common/async/yield_context.h"
-class RGWAsyncRadosProcessor;
-
-class RGWAccessListFilter {
-public:
- virtual ~RGWAccessListFilter() {}
- virtual bool filter(const std::string& name, std::string& key) = 0;
-};
+#include "rgw_tools.h"
-struct RGWAccessListFilterPrefix : public RGWAccessListFilter {
- std::string prefix;
-
- explicit RGWAccessListFilterPrefix(const std::string& _prefix) : prefix(_prefix) {}
- bool filter(const std::string& name, std::string& key) override {
- return (prefix.compare(key.substr(0, prefix.size())) == 0);
- }
-};
+class RGWAsyncRadosProcessor;
class RGWSI_RADOS : public RGWServiceInstance
{
librados::IoCtx& ioctx,
librados::NObjectIterator& iter,
uint32_t num, std::vector<rgw_bucket_dir_entry>& objs,
- RGWAccessListFilter *filter,
+ const rgw::AccessListFilter& filter,
bool *is_truncated);
public:
bool initialized{false};
librados::IoCtx ioctx;
librados::NObjectIterator iter;
- RGWAccessListFilter *filter{nullptr};
+ rgw::AccessListFilter filter;
} ctx;
List() {}
List(Pool *_pool) : pool(_pool) {}
- int init(const DoutPrefixProvider *dpp, const std::string& marker, RGWAccessListFilter *filter = nullptr);
+ int init(const DoutPrefixProvider *dpp, const std::string& marker,
+ rgw::AccessListFilter filter);
int get_next(const DoutPrefixProvider *dpp, int max,
std::vector<std::string> *oids,
bool *is_truncated);
friend class Pool::Op;
protected:
- RGWSI_RADOS *rados_svc{nullptr};
+ librados::Rados* rados{nullptr};
RGWSI_SysObj_Core *core_svc{nullptr};
- void init(RGWSI_RADOS *_rados_svc,
+ void init(librados::Rados* rados_,
RGWSI_SysObj_Core *_core_svc) {
- rados_svc = _rados_svc;
+ rados = rados_;
core_svc = _core_svc;
}
-
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
class RGWSI_SysObj_Cache : public RGWSI_SysObj_Core
{
friend class RGWSI_SysObj_Cache_CB;
- friend class RGWServices_Def;
+ friend RGWServices_Def;
friend class ASocketHandler;
RGWSI_Notify *notify_svc{nullptr};
void normalize_pool_and_obj(const rgw_pool& src_pool, const std::string& src_obj, rgw_pool& dst_pool, std::string& dst_obj);
protected:
- void init(RGWSI_RADOS *_rados_svc,
+ void init(librados::Rados* rados_,
RGWSI_Zone *_zone_svc,
RGWSI_Notify *_notify_svc) {
- core_init(_rados_svc, _zone_svc);
+ core_init(rados_, _zone_svc);
notify_svc = _notify_svc;
}
real_time set_mtime,
optional_yield y) override;
- int write_data(const DoutPrefixProvider *dpp,
+ int write_data(const DoutPrefixProvider *dpp,
const rgw_raw_obj& obj,
const bufferlist& bl,
bool exclusive,
RGWObjVersionTracker *objv_tracker,
- optional_yield y);
+ optional_yield y) override;
int distribute_cache(const DoutPrefixProvider *dpp, const std::string& normal_name, const rgw_raw_obj& obj,
ObjectCacheInfo& obj_info, int op,
using namespace std;
int RGWSI_SysObj_Core_GetObjState::get_rados_obj(const DoutPrefixProvider *dpp,
- RGWSI_RADOS *rados_svc,
+ librados::Rados* rados,
RGWSI_Zone *zone_svc,
const rgw_raw_obj& obj,
- RGWSI_RADOS::Obj **pobj)
+ rgw_rados_ref** pobj)
{
if (!has_rados_obj) {
if (obj.oid.empty()) {
return -EINVAL;
}
- rados_obj = rados_svc->obj(obj);
- int r = rados_obj.open(dpp);
+ int r = rgw_get_rados_ref(dpp, rados, obj, &rados_obj);
if (r < 0) {
return r;
}
int RGWSI_SysObj_Core::get_rados_obj(const DoutPrefixProvider *dpp,
RGWSI_Zone *zone_svc,
const rgw_raw_obj& obj,
- RGWSI_RADOS::Obj *pobj)
+ rgw_rados_ref* pobj)
{
if (obj.oid.empty()) {
ldpp_dout(dpp, 0) << "ERROR: obj.oid is empty" << dendl;
return -EINVAL;
}
- *pobj = rados_svc->obj(obj);
- int r = pobj->open(dpp);
+ int r = rgw_get_rados_ref(dpp, rados, obj, pobj);
if (r < 0) {
return r;
}
RGWObjVersionTracker *objv_tracker,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
return r;
}
}
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
}
ldpp_dout(dpp, 20) << "rados_obj.operate() r=" << r << " bl.length=" << bl->length() << dendl;
- uint64_t op_ver = rados_obj.get_last_version();
+ uint64_t op_ver = rados_obj.ioctx.get_last_version();
if (read_state.last_ver > 0 &&
read_state.last_ver != op_ver) {
bufferlist *dest,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
int rval;
op.getxattr(name, dest, &rval);
-
+
r = rados_obj.operate(dpp, &op, nullptr, y);
if (r < 0)
return r;
RGWObjVersionTracker *objv_tracker,
bool exclusive, optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
bool *pmore,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
std::map<string, bufferlist> *m,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
std::map<string, bufferlist> t;
int rval;
op.omap_get_vals2(start_after, count, &t, &more, &rval);
-
+
r = rados_obj.operate(dpp, &op, nullptr, y);
if (r < 0) {
return r;
bufferlist& bl, bool must_exist,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
const std::map<std::string, bufferlist>& m,
bool must_exist, optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
int RGWSI_SysObj_Core::omap_del(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, const std::string& key,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
uint64_t timeout_ms, bufferlist *pbl,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
const rgw_raw_obj& obj,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
real_time set_mtime,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
RGWObjVersionTracker *objv_tracker,
optional_yield y)
{
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
int r = get_rados_obj(dpp, zone_svc, obj, &rados_obj);
if (r < 0) {
ldpp_dout(dpp, 20) << "get_rados_obj() on obj=" << obj << " returned " << r << dendl;
{
bool is_truncated;
- auto rados_pool = rados_svc->pool(pool);
-
- auto op = rados_pool.op();
+ librados::IoCtx rados_pool;
+ rgw_init_ioctx(dpp, rados, pool, rados_pool, true, false);
- RGWAccessListFilterPrefix filter(prefix);
-
- int r = op.init(dpp, string(), &filter);
- if (r < 0) {
- return r;
- }
+ auto filter{rgw::AccessListFilterPrefix(prefix)};
+ std::string marker;
do {
vector<string> oids;
-#define MAX_OBJS_DEFAULT 1000
- int r = op.get_next(dpp, MAX_OBJS_DEFAULT, &oids, &is_truncated);
+ static constexpr auto MAX_OBJS_DEFAULT = 1000u;
+ int r = rgw_list_pool(dpp, rados_pool, MAX_OBJS_DEFAULT, filter, marker,
+ &oids, &is_truncated);
if (r < 0) {
return r;
}
auto& ctx = static_cast<PoolListImplInfo&>(*_ctx->impl);
- ctx.pool = rados_svc->pool(pool);
- ctx.op = ctx.pool.op();
-
- int r = ctx.op.init(dpp, marker, &ctx.filter);
+ int r = rgw_init_ioctx(dpp, rados, pool, ctx.pool, true, false);
if (r < 0) {
- ldpp_dout(dpp, 10) << "failed to list objects pool_iterate_begin() returned r=" << r << dendl;
+ ldpp_dout(dpp, 10) << "failed to create IoCtx returned r=" << r << dendl;
return r;
}
return 0;
return -EINVAL;
}
auto& ctx = static_cast<PoolListImplInfo&>(*_ctx.impl);
- int r = ctx.op.get_next(dpp, max, oids, is_truncated);
+ int r = rgw_list_pool(dpp, ctx.pool, max, ctx.filter, ctx.marker, oids,
+ is_truncated);
if (r < 0) {
if(r != -ENOENT)
ldpp_dout(dpp, 10) << "failed to list objects pool_iterate returned r=" << r << dendl;
}
auto& ctx = static_cast<PoolListImplInfo&>(*_ctx.impl);
- return ctx.op.get_marker(marker);
+ *marker = ctx.marker;
+ return 0;
}
class RGWSI_SysObj_Core : public RGWServiceInstance
{
- friend class RGWServices_Def;
+ friend struct RGWServices_Def;
friend class RGWSI_SysObj;
protected:
- RGWSI_RADOS *rados_svc{nullptr};
+ librados::Rados* rados{nullptr};
RGWSI_Zone *zone_svc{nullptr};
using GetObjState = RGWSI_SysObj_Core_GetObjState;
using PoolListImplInfo = RGWSI_SysObj_Core_PoolListImplInfo;
- void core_init(RGWSI_RADOS *_rados_svc,
+ void core_init(librados::Rados* rados_,
RGWSI_Zone *_zone_svc) {
- rados_svc = _rados_svc;
+ rados = rados_;
zone_svc = _zone_svc;
}
- int get_rados_obj(const DoutPrefixProvider *dpp, RGWSI_Zone *zone_svc, const rgw_raw_obj& obj, RGWSI_RADOS::Obj *pobj);
+ int get_rados_obj(const DoutPrefixProvider *dpp, RGWSI_Zone *zone_svc, const rgw_raw_obj& obj, rgw_rados_ref* pobj);
virtual int raw_stat(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj,
uint64_t *psize, real_time *pmtime,
#pragma once
+#include "rgw_tools.h"
#include "rgw_service.h"
#include "svc_rados.h"
struct RGWSI_SysObj_Core_GetObjState : public RGWSI_SysObj_Obj_GetObjState {
- RGWSI_RADOS::Obj rados_obj;
+ rgw_rados_ref rados_obj;
bool has_rados_obj{false};
uint64_t last_ver{0};
RGWSI_SysObj_Core_GetObjState() {}
int get_rados_obj(const DoutPrefixProvider *dpp,
- RGWSI_RADOS *rados_svc,
+ librados::Rados* rados_svc,
RGWSI_Zone *zone_svc,
const rgw_raw_obj& obj,
- RGWSI_RADOS::Obj **pobj);
+ rgw_rados_ref** pobj);
};
struct RGWSI_SysObj_Core_PoolListImplInfo : public RGWSI_SysObj_Pool_ListInfo {
- RGWSI_RADOS::Pool pool;
- RGWSI_RADOS::Pool::List op;
- RGWAccessListFilterPrefix filter;
+ librados::IoCtx pool;
+ rgw::AccessListFilter filter;
+ std::string marker;
- RGWSI_SysObj_Core_PoolListImplInfo(const std::string& prefix) : op(pool.op()), filter(prefix) {}
+ RGWSI_SysObj_Core_PoolListImplInfo(const std::string& prefix)
+ : filter(rgw::AccessListFilterPrefix(prefix)) {}
};
const std::string MP_META_SUFFIX = ".meta";
-MultipartMetaFilter::~MultipartMetaFilter() {}
-
-bool MultipartMetaFilter::filter(const string& name, string& key) {
+bool MultipartMetaFilter(const string& name, string& key) {
// the length of the suffix so we can skip past it
static const size_t MP_META_SUFFIX_LEN = MP_META_SUFFIX.length();
return true;
}
-
-
* the name provided is such. It will also extract the key used for
* bucket index shard calculation from the adorned name.
*/
-class MultipartMetaFilter : public RGWAccessListFilter {
-public:
- MultipartMetaFilter() {}
-
- virtual ~MultipartMetaFilter() override;
-
- /**
- * @param name [in] The object name as it appears in the bucket index.
- * @param key [out] An output parameter that will contain the bucket
- * index key if this entry is in the form of a multipart meta object.
- * @return true if the name provided is in the form of a multipart meta
- * object, false otherwise
- */
- bool filter(const std::string& name, std::string& key) override;
-};
+/**
+ * @param name [in] The object name as it appears in the bucket index.
+ * @param key [out] An output parameter that will contain the bucket
+ * index key if this entry is in the form of a multipart meta object.
+ * @return true if the name provided is in the form of a multipart meta
+ * object, false otherwise
+ */
+bool MultipartMetaFilter(const std::string& name, std::string& key);
class RGWSI_Tier_RADOS : public RGWServiceInstance
{