ldout(store->ctx(), 0) << __func__ << "(): deleting obj=" << obj << dendl;
- obj_ctx.obj.set_atomic(obj);
+ obj_ctx.set_atomic(obj);
RGWObjState *state;
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
int rc = valid_s3_object_name(obj_name);
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
= static_cast<RGWObjectCtx*>(get_state()->obj_ctx);
// framework promises to call op_init after parent init
ceph_assert(rados_ctx);
- RGWOp::init(rados_ctx->store, get_state(), this);
+ RGWOp::init(rados_ctx->get_store(), get_state(), this);
op = this; // assign self as op: REQUIRED
return 0;
}
RGWLibIO* io, struct req_state* _s) {
RGWRequest::init_state(_s);
- RGWHandler::init(rados_ctx->store, _s, io);
+ RGWHandler::init(rados_ctx->get_store(), _s, io);
get_state()->obj_ctx = rados_ctx;
get_state()->req_id = store->svc.zone_utils->unique_id(id);
io_ctx.init(_cct);
RGWRequest::init_state(&rstate);
- RGWHandler::init(rados_ctx.store, &rstate, &io_ctx);
+ RGWHandler::init(rados_ctx.get_store(), &rstate, &io_ctx);
get_state()->obj_ctx = &rados_ctx;
get_state()->req_id = store->svc.zone_utils->unique_id(id);
ldpp_dout(this, 20) << "reading obj=" << part << " ofs=" << cur_ofs
<< " end=" << cur_end << dendl;
- obj_ctx.obj.set_atomic(part);
+ obj_ctx.set_atomic(part);
store->set_prefetch_data(&obj_ctx, part);
RGWRados::Object op_target(store, s->bucket_info, obj_ctx, part);
}
RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx->obj.set_atomic(obj);
+ obj_ctx->set_atomic(obj);
bool ver_restored = false;
op_ret = store->swift_versioning_restore(*s->sysobj_ctx, *obj_ctx, s->bucket_owner.get_id(),
rgw_obj dst_obj(dest_bucket, dest_object);
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.obj.set_atomic(src_obj);
- obj_ctx.obj.set_atomic(dst_obj);
+ obj_ctx.set_atomic(src_obj);
+ obj_ctx.set_atomic(dst_obj);
encode_delete_at_attr(delete_at, attrs);
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.obj.set_atomic(target_obj);
+ obj_ctx.set_atomic(target_obj);
RGWRados::Object op_target(store, s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), target_obj);
RGWRados::Object::Write obj_op(&op_target);
}
}
- obj_ctx->obj.set_atomic(obj);
+ obj_ctx->set_atomic(obj);
RGWRados::Object del_target(store, s->bucket_info, *obj_ctx, obj);
RGWRados::Object::Delete del_op(&del_target);
if (!path.obj_key.empty()) {
rgw_obj obj(binfo.bucket, path.obj_key);
- obj_ctx.obj.set_atomic(obj);
+ obj_ctx.set_atomic(obj);
RGWRados::Object del_target(store, binfo, obj_ctx, obj);
RGWRados::Object::Delete del_op(&del_target);
return r;
}
- obj_ctx.obj.set_atomic(head_obj);
+ obj_ctx.set_atomic(head_obj);
RGWRados::Object op_target(store, bucket_info, obj_ctx, head_obj);
return 0;
}
-template<>
-void RGWObjectCtxImpl<rgw_obj, RGWObjState>::invalidate(const rgw_obj& obj) {
- RWLock::WLocker wl(lock);
- auto iter = objs_state.find(obj);
- if (iter == objs_state.end()) {
- return;
- }
- bool is_atomic = iter->second.is_atomic;
- bool prefetch_data = iter->second.prefetch_data;
-
- objs_state.erase(iter);
-
- if (is_atomic || prefetch_data) {
- auto& s = objs_state[obj];
- s.is_atomic = is_atomic;
- s.prefetch_data = prefetch_data;
- }
-}
-
-template<>
-void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(const rgw_raw_obj& obj) {
- RWLock::WLocker wl(lock);
- auto iter = objs_state.find(obj);
- if (iter == objs_state.end()) {
- return;
- }
-
- objs_state.erase(iter);
-}
-
void RGWObjVersionTracker::prepare_op_for_read(ObjectReadOperation *op)
{
obj_version *check_objv = version_for_check();
append_rand_alpha(cct, write_version.tag, write_version.tag, TAG_LEN);
}
-
class RGWMetaNotifierManager : public RGWCoroutinesManager {
RGWRados *store;
RGWHTTPManager http_manager;
return init_complete();
}
-int RGWRados::list_raw_prefixed_objs(const rgw_pool& pool, const string& prefix, list<string>& result)
-{
- bool is_truncated;
- RGWListRawObjsCtx ctx;
- do {
- list<string> oids;
- int r = list_raw_objects(pool, prefix, 1000,
- ctx, oids, &is_truncated);
- if (r < 0) {
- return r;
- }
- list<string>::iterator iter;
- for (iter = oids.begin(); iter != oids.end(); ++iter) {
- string& val = *iter;
- if (val.size() > prefix.size())
- result.push_back(val.substr(prefix.size()));
- }
- } while (is_truncated);
-
- return 0;
-}
-
/**
* Open the pool used as root for this gateway
* Returns: 0 on success, -ERR# otherwise.
return get_obj_data_pool(placement_rule, obj, &raw_obj->pool);
}
-int RGWRados::create_pools(vector<rgw_pool>& pools, vector<int>& retcodes)
-{
- vector<librados::PoolAsyncCompletion *> completions;
- vector<int> rets;
-
- librados::Rados *rad = get_rados_handle();
- for (auto iter = pools.begin(); iter != pools.end(); ++iter) {
- librados::PoolAsyncCompletion *c = librados::Rados::pool_async_create_completion();
- completions.push_back(c);
- rgw_pool& pool = *iter;
- int ret = rad->pool_create_async(pool.name.c_str(), c);
- rets.push_back(ret);
- }
-
- vector<int>::iterator riter;
- vector<librados::PoolAsyncCompletion *>::iterator citer;
-
- bool error = false;
- ceph_assert(rets.size() == completions.size());
- for (riter = rets.begin(), citer = completions.begin(); riter != rets.end(); ++riter, ++citer) {
- int r = *riter;
- PoolAsyncCompletion *c = *citer;
- if (r == 0) {
- c->wait();
- r = c->get_return_value();
- if (r < 0) {
- ldout(cct, 0) << "WARNING: async pool_create returned " << r << dendl;
- error = true;
- }
- }
- c->release();
- retcodes.push_back(r);
- }
- if (error) {
- return 0;
- }
-
- std::vector<librados::IoCtx> io_ctxs;
- retcodes.clear();
- for (auto pool : pools) {
- io_ctxs.emplace_back();
- int ret = rad->ioctx_create(pool.name.c_str(), io_ctxs.back());
- if (ret < 0) {
- ldout(cct, 0) << "WARNING: ioctx_create returned " << ret << dendl;
- error = true;
- }
- retcodes.push_back(ret);
- }
- if (error) {
- return 0;
- }
-
- completions.clear();
- for (auto &io_ctx : io_ctxs) {
- librados::PoolAsyncCompletion *c =
- librados::Rados::pool_async_create_completion();
- completions.push_back(c);
- int ret = io_ctx.application_enable_async(pg_pool_t::APPLICATION_NAME_RGW,
- false, c);
- ceph_assert(ret == 0);
- }
-
- retcodes.clear();
- for (auto c : completions) {
- c->wait();
- int ret = c->get_return_value();
- if (ret == -EOPNOTSUPP) {
- ret = 0;
- } else if (ret < 0) {
- ldout(cct, 0) << "WARNING: async application_enable returned " << ret
- << dendl;
- error = true;
- }
- c->release();
- retcodes.push_back(ret);
- }
- return 0;
-}
-
int RGWRados::get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx)
{
string oid, key;
return 0;
}
- obj_ctx.obj.set_atomic(obj);
+ obj_ctx.set_atomic(obj);
RGWObjState * state = nullptr;
int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false);
}
rgw_obj dest_obj(dest_bucket_info.bucket, buf);
- obj_ctx.obj.set_atomic(dest_obj);
+ obj_ctx.set_atomic(dest_obj);
string no_zone;
std::map<std::string, ceph::bufferlist> no_attrs;
rgw_obj archive_obj(archive_binfo.bucket, entry.key);
- obj_ctx.obj.set_atomic(archive_obj);
- obj_ctx.obj.set_atomic(obj);
+ obj_ctx.set_atomic(archive_obj);
+ obj_ctx.set_atomic(obj);
int ret = copy_obj(obj_ctx,
user,
}
if (copy_if_newer && canceled) {
ldout(cct, 20) << "raced with another write of obj: " << dest_obj << dendl;
- obj_ctx.obj.invalidate(dest_obj); /* object was overwritten */
+ obj_ctx.invalidate(dest_obj); /* object was overwritten */
ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
if (ret < 0) {
ldout(cct, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
return 0;
}
-int RGWRados::get_system_obj_state_impl(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker)
-{
- if (obj.empty()) {
- return -EINVAL;
- }
-
- RGWRawObjState *s = rctx->raw.get_state(obj);
- ldout(cct, 20) << "get_system_obj_state: rctx=" << (void *)rctx << " obj=" << obj << " state=" << (void *)s << " s->prefetch_data=" << s->prefetch_data << dendl;
- *state = s;
- if (s->has_attrs) {
- return 0;
- }
-
- s->obj = obj;
-
- int r = raw_obj_stat(obj, &s->size, &s->mtime, &s->epoch, &s->attrset, (s->prefetch_data ? &s->data : NULL), objv_tracker);
- if (r == -ENOENT) {
- s->exists = false;
- s->has_attrs = true;
- s->mtime = real_time();
- return 0;
- }
- if (r < 0)
- return r;
-
- s->exists = true;
- s->has_attrs = true;
- s->obj_tag = s->attrset[RGW_ATTR_ID_TAG];
-
- if (s->obj_tag.length())
- ldout(cct, 20) << "get_system_obj_state: setting s->obj_tag to "
- << s->obj_tag.c_str() << dendl;
- else
- ldout(cct, 20) << "get_system_obj_state: s->obj_tag was set empty" << dendl;
-
- return 0;
-}
-
-int RGWRados::get_system_obj_state(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker)
-{
- int ret;
-
- do {
- ret = get_system_obj_state_impl(rctx, obj, state, objv_tracker);
- } while (ret == -EAGAIN);
-
- return ret;
-}
-
int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
RGWObjState **state, bool follow_olh, bool assume_noent)
{
bool need_follow_olh = follow_olh && obj.key.instance.empty();
- RGWObjState *s = rctx->obj.get_state(obj);
+ RGWObjState *s = rctx->get_state(obj);
ldout(cct, 20) << "get_obj_state: rctx=" << (void *)rctx << " obj=" << obj << " state=" << (void *)s << " s->prefetch_data=" << s->prefetch_data << dendl;
*state = s;
if (s->has_attrs) {
rgw_obj& obj = source->get_obj();
RGWRados *store = source->get_store();
- RGWObjState *s = ctx.obj.get_state(obj); /* calling this one directly because otherwise a sync request will be sent */
+ RGWObjState *s = ctx.get_state(obj); /* calling this one directly because otherwise a sync request will be sent */
result.obj = obj;
if (s->has_attrs) {
state.ret = 0;
void RGWRados::Object::invalidate_state()
{
- ctx.obj.invalidate(obj);
+ ctx.invalidate(obj);
}
int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool reset_obj, const string *ptag,
#define MAX_ECANCELED_RETRY 100
for (i = 0; i < MAX_ECANCELED_RETRY; i++) {
if (ret == -ECANCELED) {
- obj_ctx.obj.invalidate(olh_obj);
+ obj_ctx.invalidate(olh_obj);
}
ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
for (i = 0; i < MAX_ECANCELED_RETRY; i++) {
if (ret == -ECANCELED) {
- obj_ctx.obj.invalidate(olh_obj);
+ obj_ctx.invalidate(olh_obj);
}
ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
{
RGWRados *store = new RGWRados;
- store->set_use_cache(use_cache);
-
- if (store->initialize(cct, use_gc_thread, use_lc_thread, quota_threads, run_sync_thread, run_reshard_thread) < 0) {
+ if ((*store).set_use_cache(use_cache)
+ .set_run_gc_thread(use_gc_thread)
+ .set_run_lc_thread(use_lc_thread)
+ .set_run_quota_threads(quota_threads)
+ .set_run_sync_thread(run_sync_thread)
+ .set_run_reshard_thread(run_reshard_thread)
+ .initialize(cct) < 0) {
delete store;
return NULL;
}
class RGWGetDirHeader_CB;
class RGWGetUserHeader_CB;
-template <class T, class S>
-class RGWObjectCtxImpl {
+class RGWObjectCtx {
RGWRados *store;
- std::map<T, S> objs_state;
- RWLock lock;
+ RWLock lock{"RGWObjectCtx"};
+ void *s{nullptr};
+ std::map<rgw_obj, RGWObjState> objs_state;
public:
- explicit RGWObjectCtxImpl(RGWRados *_store) : store(_store), lock("RGWObjectCtxImpl") {}
+ explicit RGWObjectCtx(RGWRados *_store) : store(_store) {}
+ explicit RGWObjectCtx(RGWRados *_store, void *_s) : store(_store), s(_s) {}
- S *get_state(const T& obj) {
- S *result;
- typename std::map<T, S>::iterator iter;
+ void *get_private() {
+ return s;
+ }
+
+ RGWRados *get_store() {
+ return store;
+ }
+
+ RGWObjState *get_state(const rgw_obj& obj) {
+ RGWObjState *result;
+ typename std::map<rgw_obj, RGWObjState>::iterator iter;
lock.get_read();
assert (!obj.empty());
iter = objs_state.find(obj);
return result;
}
- void set_atomic(T& obj) {
+ void set_atomic(rgw_obj& obj) {
RWLock::WLocker wl(lock);
assert (!obj.empty());
objs_state[obj].is_atomic = true;
}
- void set_prefetch_data(T& obj) {
+ void set_prefetch_data(rgw_obj& obj) {
RWLock::WLocker wl(lock);
assert (!obj.empty());
objs_state[obj].prefetch_data = true;
}
- void invalidate(const T& obj);
-};
-
-template<>
-void RGWObjectCtxImpl<rgw_obj, RGWObjState>::invalidate(const rgw_obj& obj);
-
-template<>
-void RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState>::invalidate(const rgw_raw_obj& obj);
-
-struct RGWObjectCtx {
- RGWRados *store;
- req_state *s;
- RGWObjectCtxImpl<rgw_obj, RGWObjState> obj;
- RGWObjectCtxImpl<rgw_raw_obj, RGWRawObjState> raw;
+ void invalidate(const rgw_obj& obj) {
+ RWLock::WLocker wl(lock);
+ auto iter = objs_state.find(obj);
+ if (iter == objs_state.end()) {
+ return;
+ }
+ bool is_atomic = iter->second.is_atomic;
+ bool prefetch_data = iter->second.prefetch_data;
+
+ objs_state.erase(iter);
- explicit RGWObjectCtx(RGWRados *_store) : store(_store), s(NULL), obj(store), raw(store) { }
- explicit RGWObjectCtx(RGWRados *_store, req_state *_s) : store(_store), s(_s), obj(store), raw(store) { }
+ if (is_atomic || prefetch_data) {
+ auto& state = objs_state[obj];
+ state.is_atomic = is_atomic;
+ state.prefetch_data = prefetch_data;
+ }
+ }
};
class RGWAsyncRadosProcessor;
int get_olh_target_state(RGWObjectCtx& rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
RGWObjState *olh_state, RGWObjState **target_state);
- int get_system_obj_state_impl(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker);
int get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
bool follow_olh, bool assume_noent = false);
int append_atomic_test(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
cr_registry(NULL),
meta_mgr(NULL), data_log(NULL), reshard(NULL) {}
- void set_use_cache(bool status) {
+ RGWRados& set_use_cache(bool status) {
use_cache = status;
+ return *this;
+ }
+
+ RGWRados& set_run_gc_thread(bool _use_gc_thread) {
+ use_gc_thread = _use_gc_thread;
+ return *this;
+ }
+
+ RGWRados& set_run_lc_thread(bool _use_lc_thread) {
+ use_lc_thread = _use_lc_thread;
+ return *this;
+ }
+
+ RGWRados& set_run_quota_threads(bool _run_quota_threads) {
+ quota_threads = _run_quota_threads;
+ return *this;
+ }
+
+ RGWRados& set_run_sync_thread(bool _run_sync_thread) {
+ run_sync_thread = _run_sync_thread;
+ return *this;
+ }
+
+ RGWRados& set_run_reshard_thread(bool _run_reshard_thread) {
+ run_reshard_thread = _run_reshard_thread;
+ return *this;
}
uint64_t get_new_req_id() {
bool *is_truncated);
string list_raw_objs_get_cursor(RGWListRawObjsCtx& ctx);
- int list_raw_prefixed_objs(const rgw_pool& pool, const string& prefix, list<string>& result);
-
CephContext *ctx() { return cct; }
/** do all necessary setup of the storage device */
- int initialize(CephContext *_cct, bool _use_gc_thread, bool _use_lc_thread, bool _quota_threads, bool _run_sync_thread, bool _run_reshard_thread) {
+ int initialize(CephContext *_cct) {
set_context(_cct);
- use_gc_thread = _use_gc_thread;
- use_lc_thread = _use_lc_thread;
- quota_threads = _quota_threads;
- run_sync_thread = _run_sync_thread;
- run_reshard_thread = _run_reshard_thread;
return initialize();
}
/** Initialize the RADOS instance and prepare to do other ops */
int register_to_service_map(const string& daemon_type, const map<string, string>& meta);
int update_service_map(std::map<std::string, std::string>&& status);
- void schedule_context(Context *c);
-
/** set up a bucket listing. handle is filled in. */
int list_buckets_init(RGWAccessHandle *handle);
/**
rgw_bucket *master_bucket,
uint32_t *master_num_shards,
bool exclusive = true);
- int create_pools(vector<rgw_pool>& pools, vector<int>& retcodes);
RGWCoroutinesManagerRegistry *get_cr_registry() { return cr_registry; }
map<std::string, bufferlist>& attrs);
int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive);
const req_state* get_req_state() {
- return target->get_ctx().s;
+ return (req_state *)target->get_ctx().get_private();
}
};
map<string, bufferlist>& attrs,
map<string, bufferlist>* rmattrs);
- int get_system_obj_state(RGWObjectCtx *rctx, rgw_raw_obj& obj, RGWRawObjState **state, RGWObjVersionTracker *objv_tracker);
int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
bool follow_olh, bool assume_noent = false);
int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state) {
* a simple object read without keeping state
*/
- virtual int raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, ceph::real_time *pmtime, uint64_t *epoch,
- map<string, bufferlist> *attrs, bufferlist *first_chunk,
- RGWObjVersionTracker *objv_tracker);
+ int raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, ceph::real_time *pmtime, uint64_t *epoch,
+ map<string, bufferlist> *attrs, bufferlist *first_chunk,
+ RGWObjVersionTracker *objv_tracker);
int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectWriteOperation *op);
int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectReadOperation *op);
public:
void set_atomic(void *ctx, rgw_obj& obj) {
RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
- rctx->obj.set_atomic(obj);
+ rctx->set_atomic(obj);
}
void set_prefetch_data(void *ctx, rgw_obj& obj) {
RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
- rctx->obj.set_prefetch_data(obj);
+ rctx->set_prefetch_data(obj);
}
int decode_policy(bufferlist& bl, ACLOwner *owner);
int get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id, string *bucket_ver, string *master_ver,
// `cache_list_dump_helper` with the supplied Formatter on any that
// include `filter` as a substring.
//
- virtual void call_list(const std::optional<std::string>& filter,
+ void call_list(const std::optional<std::string>& filter,
Formatter* format);
// `call_inspect` must look up the requested target and, if found,
// dump it to the supplied Formatter and return true. If not found,
// it must return false.
//
- virtual bool call_inspect(const std::string& target, Formatter* format);
+ bool call_inspect(const std::string& target, Formatter* format);
// `call_erase` must erase the requested target and return true. If
// the requested target does not exist, it should return false.
- virtual bool call_erase(const std::string& target);
+ bool call_erase(const std::string& target);
// `call_zap` must erase the cache.
- virtual void call_zap();
+ void call_zap();
public:
int get_bucket_info(RGWSysObjectCtx& obj_ctx,
rgw_obj obj(s->bucket, subdir_name);
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.obj.set_atomic(obj);
- obj_ctx.obj.set_prefetch_data(obj);
+ obj_ctx.set_atomic(obj);
+ obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
/* First, get attrset of the object we'll try to retrieve. */
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.obj.set_atomic(obj);
- obj_ctx.obj.set_prefetch_data(obj);
+ obj_ctx.set_atomic(obj);
+ obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
rgw_obj obj(s->bucket, index);
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.obj.set_atomic(obj);
- obj_ctx.obj.set_prefetch_data(obj);
+ obj_ctx.set_atomic(obj);
+ obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
vector<librados::PoolAsyncCompletion *>::iterator citer;
bool error = false;
- assert(rets.size() == completions.size());
+ ceph_assert(rets.size() == completions.size());
for (riter = rets.begin(), citer = completions.begin(); riter != rets.end(); ++riter, ++citer) {
int r = *riter;
librados::PoolAsyncCompletion *c = *citer;
completions.push_back(c);
int ret = io_ctx.application_enable_async(pg_pool_t::APPLICATION_NAME_RGW,
false, c);
- assert(ret == 0);
+ ceph_assert(ret == 0);
}
retcodes->clear();