Can't forward declare nested class.
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
{
RGWBucketInfo bucket_info;
time_t mtime;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
int r = store->get_bucket_info(obj_ctx, bucket.name, bucket_info, &mtime);
if (r < 0)
return r;
static int init_bucket(string& bucket_name, RGWBucketInfo& bucket_info, rgw_bucket& bucket)
{
if (!bucket_name.empty()) {
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
int r = store->get_bucket_info(obj_ctx, bucket_name, bucket_info, NULL);
if (r < 0) {
cerr << "could not get bucket info for bucket=" << bucket_name << std::endl;
{
RGWBucketInfo bucket_info;
map<string, bufferlist> attrs;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
int r = store->get_bucket_info(obj_ctx, bucket_name, bucket_info, NULL, &attrs);
if (r < 0) {
cerr << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(-r) << std::endl;
map<string, bufferlist> attrs;
uint64_t obj_size;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
RGWRados::Object op_target(store, obj_ctx, obj);
RGWRados::Object::Read read_op(&op_target);
uint64_t obj_size;
map<string, bufferlist> attrs;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
RGWRados::Object op_target(store, obj_ctx, obj);
RGWRados::Object::Read read_op(&op_target);
int rgw_remove_object(RGWRados *store, const string& bucket_owner, rgw_bucket& bucket, rgw_obj_key& key, bool use_versioning)
{
- RGWRados::ObjectCtx rctx(store);
+ RGWObjectCtx rctx(store);
rgw_obj obj(bucket, key);
if (!object_name.empty()) {
bufferlist bl;
rgw_obj obj(bucket, object_name);
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
int ret = store->get_attr(obj_ctx, obj, RGW_ATTR_ACL, bl);
if (ret < 0)
return ret;
struct req_state *s = &rstate;
- RGWRados::ObjectCtx rados_ctx(store, s);
+ RGWObjectCtx rados_ctx(store, s);
s->obj_ctx = &rados_ctx;
store->set_intent_cb(s->obj_ctx, call_log_intent);
return 0;
}
-static int get_obj_policy_from_attr(CephContext *cct, RGWRados *store, RGWRados::ObjectCtx& obj_ctx,
+static int get_obj_policy_from_attr(CephContext *cct, RGWRados *store, RGWObjectCtx& obj_ctx,
RGWBucketInfo& bucket_info, map<string, bufferlist>& bucket_attrs,
RGWAccessControlPolicy *policy, rgw_obj& obj)
{
return get_bucket_policy_from_attr(cct, store, ctx, bucket_info, bucket_attrs,
policy, instance_obj);
}
- return get_obj_policy_from_attr(cct, store, *(RGWRados::ObjectCtx *)ctx, bucket_info, bucket_attrs,
+ return get_obj_policy_from_attr(cct, store, *(RGWObjectCtx *)ctx, bucket_info, bucket_attrs,
policy, obj);
}
static int get_obj_attrs(RGWRados *store, struct req_state *s, rgw_obj& obj, map<string, bufferlist>& attrs)
{
- RGWRados::Object op_target(store, *(RGWRados::ObjectCtx *)s->obj_ctx, obj);
+ RGWRados::Object op_target(store, *(RGWObjectCtx *)s->obj_ctx, obj);
RGWRados::Object::Read read_op(&op_target);
read_op.params.attrs = &attrs;
static int get_system_obj_attrs(RGWRados *store, struct req_state *s, rgw_obj& obj, map<string, bufferlist>& attrs,
uint64_t *obj_size, RGWObjVersionTracker *objv_tracker)
{
- RGWRados::SystemObject src(store, *(RGWRados::ObjectCtx *)s->obj_ctx, obj);
+ RGWRados::SystemObject src(store, *(RGWObjectCtx *)s->obj_ctx, obj);
RGWRados::SystemObject::Read rop(&src);
rop.stat_params.attrs = &attrs;
int ret = 0;
rgw_obj_key obj;
RGWUserInfo bucket_owner_info;
- RGWRados::ObjectCtx& obj_ctx = *(RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx& obj_ctx = *(RGWObjectCtx *)s->obj_ctx;
s->bucket_instance_id = s->info.args.get(RGW_SYS_PARAM_PREFIX "bucket-instance");
map<string, bufferlist> attrs;
uint64_t obj_size;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
RGWAccessControlPolicy obj_policy(s->cct);
ldout(s->cct, 20) << "reading obj=" << part << " ofs=" << cur_ofs << " end=" << cur_end << dendl;
if (bucket_name.compare(s->bucket.name) != 0) {
RGWBucketInfo bucket_info;
map<string, bufferlist> bucket_attrs;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
int r = store->get_bucket_info(obj_ctx, bucket_name, bucket_info, NULL, &bucket_attrs);
if (r < 0) {
ldout(s->cct, 0) << "could not get bucket info for bucket=" << bucket_name << dendl;
perfcounter->inc(l_rgw_get);
int64_t new_ofs, new_end;
- RGWRados::Object op_target(store, *(RGWRados::ObjectCtx *)s->obj_ctx, obj);
+ RGWRados::Object op_target(store, *(RGWObjectCtx *)s->obj_ctx, obj);
RGWRados::Object::Read read_op(&op_target);
ret = get_params();
}
/* we need to make sure we read bucket info, it's not read before for this specific request */
- RGWRados::ObjectCtx& obj_ctx = *(RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx& obj_ctx = *(RGWObjectCtx *)s->obj_ctx;
ret = store->get_bucket_info(obj_ctx, s->bucket_name_str, s->bucket_info, NULL, &s->bucket_attrs);
if (ret < 0 && ret != -ENOENT)
return;
public:
bool immutable_head() { return true; }
- RGWPutObjProcessor_Multipart(RGWRados::ObjectCtx& obj_ctx, const string& bucket_owner, uint64_t _p, req_state *_s) :
+ RGWPutObjProcessor_Multipart(RGWObjectCtx& obj_ctx, const string& bucket_owner, uint64_t _p, req_state *_s) :
RGWPutObjProcessor_Atomic(obj_ctx, bucket_owner, _s->bucket, _s->object.name, _p, _s->req_id, false), s(_s) {}
};
}
-RGWPutObjProcessor *RGWPutObj::select_processor(RGWRados::ObjectCtx& obj_ctx, bool *is_multipart)
+RGWPutObjProcessor *RGWPutObj::select_processor(RGWObjectCtx& obj_ctx, bool *is_multipart)
{
RGWPutObjProcessor *processor;
supplied_md5[sizeof(supplied_md5) - 1] = '\0';
}
- processor = select_processor(*(RGWRados::ObjectCtx *)s->obj_ctx, &multipart);
+ processor = select_processor(*(RGWObjectCtx *)s->obj_ctx, &multipart);
ret = processor->prepare(store, NULL);
if (ret < 0)
/* restart processing with different oid suffix */
dispose_processor(processor);
- processor = select_processor(*(RGWRados::ObjectCtx *)s->obj_ctx, &multipart);
+ processor = select_processor(*(RGWObjectCtx *)s->obj_ctx, &multipart);
string oid_rand;
char buf[33];
return 0;
}
-RGWPutObjProcessor *RGWPostObj::select_processor(RGWRados::ObjectCtx& obj_ctx)
+RGWPutObjProcessor *RGWPostObj::select_processor(RGWObjectCtx& obj_ctx)
{
RGWPutObjProcessor *processor;
goto done;
}
- processor = select_processor(*(RGWRados::ObjectCtx *)s->obj_ctx);
+ processor = select_processor(*(RGWObjectCtx *)s->obj_ctx);
ret = processor->prepare(store, NULL);
if (ret < 0)
ret = -EINVAL;
rgw_obj obj(s->bucket, s->object);
if (!s->object.empty()) {
- RGWRados::ObjectCtx *obj_ctx = (RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx *obj_ctx = (RGWObjectCtx *)s->obj_ctx;
obj_ctx->set_atomic(obj);
map<string, bufferlist> src_attrs;
- RGWRados::ObjectCtx& obj_ctx = *(RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx& obj_ctx = *(RGWObjectCtx *)s->obj_ctx;
ret = store->get_bucket_info(obj_ctx, src_bucket_name, src_bucket_info, NULL, &src_attrs);
if (ret < 0)
rgw_obj src_obj(src_bucket, src_object);
rgw_obj dst_obj(dest_bucket, dest_object);
- RGWRados::ObjectCtx& obj_ctx = *(RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx& obj_ctx = *(RGWObjectCtx *)s->obj_ctx;
obj_ctx.set_atomic(src_obj);
obj_ctx.set_atomic(dst_obj);
// the meta object will be indexed with 0 size, we c
obj.set_in_extra_data(true);
- RGWRados::Object op_target(store, *(RGWRados::ObjectCtx *)s->obj_ctx, obj);
+ RGWRados::Object op_target(store, *(RGWObjectCtx *)s->obj_ctx, obj);
RGWRados::Object::Write obj_op(&op_target);
obj_op.meta.owner = s->owner.get_id();
store->gen_rand_obj_instance_name(&target_obj);
}
- RGWRados::ObjectCtx& obj_ctx = *(RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx& obj_ctx = *(RGWObjectCtx *)s->obj_ctx;
obj_ctx.set_atomic(target_obj);
- RGWRados::Object op_target(store, *(RGWRados::ObjectCtx *)s->obj_ctx, target_obj);
+ RGWRados::Object op_target(store, *(RGWObjectCtx *)s->obj_ctx, target_obj);
RGWRados::Object::Write obj_op(&op_target);
obj_op.meta.manifest = &manifest;
}
// remove the upload obj
- int r = store->delete_obj(*(RGWRados::ObjectCtx *)s->obj_ctx, s->bucket_owner.get_id(), meta_obj, false);
+ int r = store->delete_obj(*(RGWObjectCtx *)s->obj_ctx, s->bucket_owner.get_id(), meta_obj, false);
if (r < 0) {
ldout(store->ctx(), 0) << "WARNING: failed to remove object " << meta_obj << dendl;
}
int marker = 0;
int max_parts = 1000;
- RGWRados::ObjectCtx *obj_ctx = (RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx *obj_ctx = (RGWObjectCtx *)s->obj_ctx;
do {
ret = list_multipart_parts(store, s, upload_id, meta_oid, max_parts, marker, obj_parts, &marker, &truncated);
RGWMultiDelXMLParser parser;
pair<string,int> result;
int num_processed = 0;
- RGWRados::ObjectCtx *obj_ctx = (RGWRados::ObjectCtx *)s->obj_ctx;
+ RGWObjectCtx *obj_ctx = (RGWObjectCtx *)s->obj_ctx;
ret = get_params();
if (ret < 0) {
policy.set_ctx(s->cct);
}
- RGWPutObjProcessor *select_processor(RGWRados::ObjectCtx& obj_ctx, bool *is_multipart);
+ RGWPutObjProcessor *select_processor(RGWObjectCtx& obj_ctx, bool *is_multipart);
void dispose_processor(RGWPutObjProcessor *processor);
int verify_permission();
void pre_exec();
void execute();
- RGWPutObjProcessor *select_processor(RGWRados::ObjectCtx& obj_ctx);
+ RGWPutObjProcessor *select_processor(RGWObjectCtx& obj_ctx);
void dispose_processor(RGWPutObjProcessor *processor);
virtual int get_params() = 0;
rgw_bucket pool(pool_name.c_str());
bufferlist bl;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
ret = rgw_get_system_obj(store, obj_ctx, pool, oid, bl, NULL, NULL);
if (ret < 0)
return ret;
string oid = region_info_oid_prefix + name;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
ret = rgw_get_system_obj(store, obj_ctx, pool, oid, bl, NULL, NULL);
if (ret < 0) {
lderr(cct) << "failed reading region info from " << pool << ":" << oid << ": " << cpp_strerror(-ret) << dendl;
bufferlist bl;
string oid = zone_info_oid_prefix + name;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
ret = rgw_get_system_obj(store, obj_ctx, pool, oid, bl, NULL, NULL);
if (ret < 0)
return ret;
rgw_bucket pool(pool_name.c_str());
bufferlist bl;
- RGWRados::ObjectCtx obj_ctx(store);
+ RGWObjectCtx obj_ctx(store);
int ret = rgw_get_system_obj(store, obj_ctx, pool, oid, bl, NULL, NULL);
if (ret < 0)
return ret;
}
};
-RGWObjState *RGWRados::ObjectCtx::get_state(rgw_obj& obj) {
+RGWObjState *RGWObjectCtx::get_state(rgw_obj& obj) {
if (!obj.get_object().empty()) {
return &objs_state[obj];
} else {
}
}
-void RGWRados::ObjectCtx::invalidate(rgw_obj& obj)
+void RGWObjectCtx::invalidate(rgw_obj& obj)
{
objs_state.erase(obj);
}
-void RGWRados::ObjectCtx::set_atomic(rgw_obj& obj) {
+void RGWObjectCtx::set_atomic(rgw_obj& obj) {
if (!obj.get_object().empty()) {
objs_state[obj].is_atomic = true;
} else {
}
}
-void RGWRados::ObjectCtx::set_prefetch_data(rgw_obj& obj) {
+void RGWObjectCtx::set_prefetch_data(rgw_obj& obj) {
if (!obj.get_object().empty()) {
objs_state[obj].prefetch_data = true;
} else {
if (ret == -EEXIST) {
/* we need to reread the info and return it, caller will have a use for it */
info.objv_tracker.clear();
- ObjectCtx obj_ctx(this);
+ RGWObjectCtx obj_ctx(this);
r = get_bucket_info(obj_ctx, bucket.name, info, NULL, NULL);
if (r < 0) {
if (r == -ENOENT) {
rgw_obj obj(zone.domain_root, avail_pools);
- RGWRados::ObjectCtx obj_ctx(this);
+ RGWObjectCtx obj_ctx(this);
int ret = rgw_get_system_obj(this, obj_ctx, zone.domain_root, avail_pools, map_bl, NULL, NULL);
if (ret < 0) {
goto read_omap;
time_t mtime;
uint64_t total_len;
uint64_t obj_size;
- ObjectCtx rctx(this);
+ RGWObjectCtx rctx(this);
RGWRados::Object op_target(this, rctx, obj);
RGWRados::Object::Read read_op(&op_target);
* err: stores any errors resulting from the get of the original object
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::copy_obj(ObjectCtx& obj_ctx,
+int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
const string& user_id,
const string& client_id,
const string& op_id,
}
-int RGWRados::copy_obj_data(ObjectCtx& obj_ctx,
+int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
RGWBucketInfo& dest_bucket_info,
RGWRados::Object::Read& read_op, off_t end,
rgw_obj& dest_obj,
{
RGWBucketInfo info;
map<string, bufferlist> attrs;
- ObjectCtx obj_ctx(this);
+ RGWObjectCtx obj_ctx(this);
int r = get_bucket_info(obj_ctx, bucket.name, info, NULL, &attrs);
if (r < 0) {
ldout(cct, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << dendl;
RGWBucketInfo info;
map<string, bufferlist> attrs;
- ObjectCtx obj_ctx(this);
+ RGWObjectCtx obj_ctx(this);
int r = get_bucket_info(obj_ctx, bucket.name, info, NULL, &attrs);
if (r < 0) {
ldout(cct, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << ", skipping bucket" << dendl;
int RGWRados::bucket_suspended(rgw_bucket& bucket, bool *suspended)
{
RGWBucketInfo bucket_info;
- ObjectCtx obj_ctx(this);
+ RGWObjectCtx obj_ctx(this);
int ret = get_bucket_info(obj_ctx, bucket.name, bucket_info, NULL);
if (ret < 0) {
return ret;
int RGWRados::defer_gc(void *ctx, rgw_obj& obj)
{
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
rgw_bucket bucket;
std::string oid, key;
get_obj_bucket_and_oid_loc(obj, bucket, oid, key);
return 0;
}
-int RGWRados::delete_obj(RGWRados::ObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& obj, bool use_versioning)
+int RGWRados::delete_obj(RGWObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& obj, bool use_versioning)
{
RGWRados::Object del_target(this, obj_ctx, obj);
RGWRados::Object::Delete del_op(&del_target);
return (iter != attrs.end());
}
-int RGWRados::get_olh_target_state(ObjectCtx& obj_ctx, rgw_obj& obj, RGWObjState *olh_state,
+int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, rgw_obj& obj, RGWObjState *olh_state,
RGWObjState **target_state, RGWObjVersionTracker *objv_tracker)
{
assert(olh_state->is_olh);
return 0;
}
-int RGWRados::get_obj_state_impl(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
+int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
#warning FIXME: get rid objv_tracker for non system objects
{
RGWObjState *s = rctx->get_state(obj);
return 0;
}
-int RGWRados::get_obj_state(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
+int RGWRados::get_obj_state(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
{
int ret;
* dest: bufferlist to store the result in
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::get_attr(ObjectCtx& obj_ctx, rgw_obj& obj, const char *name, bufferlist& dest)
+int RGWRados::get_attr(RGWObjectCtx& obj_ctx, rgw_obj& obj, const char *name, bufferlist& dest)
{
rgw_rados_ref ref;
rgw_bucket bucket;
return 0;
}
-int RGWRados::append_atomic_test(ObjectCtx *rctx, rgw_obj& obj,
+int RGWRados::append_atomic_test(RGWObjectCtx *rctx, rgw_obj& obj,
ObjectOperation& op, RGWObjState **pstate)
{
if (!rctx)
if (r < 0) {
return r;
}
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
ObjectWriteOperation op;
RGWObjState *state = NULL;
return store->get_obj_state(&ctx, obj, pstate, objv_tracker, false);
}
-int RGWRados::stat_system_obj(RGWRados::ObjectCtx& obj_ctx,
+int RGWRados::stat_system_obj(RGWObjectCtx& obj_ctx,
RGWRados::SystemObject::Read::GetObjState& state,
rgw_obj& obj,
map<string, bufferlist> *attrs,
}
-int RGWRados::get_system_obj(ObjectCtx& obj_ctx, RGWRados::SystemObject::Read::GetObjState& read_state,
+int RGWRados::get_system_obj(RGWObjectCtx& obj_ctx, RGWRados::SystemObject::Read::GetObjState& read_state,
RGWObjVersionTracker *objv_tracker, rgw_obj& obj,
bufferlist& bl, off_t ofs, off_t end,
rgw_cache_entry_info *cache_info)
off_t read_ofs, off_t len,
bool is_head_obj, void *arg)
{
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
ObjectReadOperation op;
struct get_obj_data *d = (struct get_obj_data *)arg;
string oid, key;
rgw_obj read_obj = obj;
uint64_t read_ofs = ofs;
uint64_t len;
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
- ObjectCtx *new_ctx = NULL;
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
+ RGWObjectCtx *new_ctx = NULL;
bool reading_from_head = true;
RGWObjState *astate = NULL;
if (!rctx) {
- new_ctx = new ObjectCtx(this);
+ new_ctx = new RGWObjectCtx(this);
rctx = new_ctx;
}
if (r < 0) {
return r;
}
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
RGWObjState *astate = NULL;
ObjectReadOperation op;
op.setxattr(name, bl);
}
-int RGWRados::apply_olh_log(ObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& obj,
+int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& obj,
bufferlist& obj_tag, map<uint64_t, rgw_bucket_olh_log_entry>& log,
uint64_t *plast_ver)
{
/*
* read olh log and apply it
*/
-int RGWRados::update_olh(ObjectCtx& obj_ctx, RGWObjState *state, const string& bucket_owner, rgw_obj& obj)
+int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const string& bucket_owner, rgw_obj& obj)
{
map<uint64_t, rgw_bucket_olh_log_entry> log;
bool is_truncated;
return 0;
}
-int RGWRados::set_olh(ObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& target_obj, bool delete_marker)
+int RGWRados::set_olh(RGWObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& target_obj, bool delete_marker)
{
string op_tag;
string obj_tag;
return 0;
}
-int RGWRados::follow_olh(ObjectCtx& obj_ctx, RGWObjState *state, rgw_obj& olh_obj, rgw_obj *target)
+int RGWRados::follow_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, rgw_obj& olh_obj, rgw_obj *target)
{
map<string, bufferlist> pending_entries;
filter_attrset(state->attrset, RGW_ATTR_OLH_PENDING_PREFIX, &pending_entries);
}
}
-int RGWRados::get_bucket_instance_info(ObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info,
+int RGWRados::get_bucket_instance_info(RGWObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs)
{
int pos = meta_key.find(':');
return get_bucket_instance_from_oid(obj_ctx, oid, info, pmtime, pattrs);
}
-int RGWRados::get_bucket_instance_info(ObjectCtx& obj_ctx, rgw_bucket& bucket, RGWBucketInfo& info,
+int RGWRados::get_bucket_instance_info(RGWObjectCtx& obj_ctx, rgw_bucket& bucket, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs)
{
string oid;
return get_bucket_instance_from_oid(obj_ctx, oid, info, pmtime, pattrs);
}
-int RGWRados::get_bucket_instance_from_oid(ObjectCtx& obj_ctx, string& oid, RGWBucketInfo& info,
+int RGWRados::get_bucket_instance_from_oid(RGWObjectCtx& obj_ctx, string& oid, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs,
rgw_cache_entry_info *cache_info)
{
return 0;
}
-int RGWRados::get_bucket_entrypoint_info(ObjectCtx& obj_ctx, const string& bucket_name,
+int RGWRados::get_bucket_entrypoint_info(RGWObjectCtx& obj_ctx, const string& bucket_name,
RGWBucketEntryPoint& entry_point,
RGWObjVersionTracker *objv_tracker,
time_t *pmtime,
return 0;
}
-int RGWRados::convert_old_bucket_info(ObjectCtx& obj_ctx, string& bucket_name)
+int RGWRados::convert_old_bucket_info(RGWObjectCtx& obj_ctx, string& bucket_name)
{
RGWBucketEntryPoint entry_point;
time_t ep_mtime;
static RGWChainedCacheImpl<bucket_info_entry> binfo_cache;
-int RGWRados::get_bucket_info(ObjectCtx& obj_ctx, const string& bucket_name, RGWBucketInfo& info,
+int RGWRados::get_bucket_info(RGWObjectCtx& obj_ctx, const string& bucket_name, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs)
{
bucket_info_entry e;
io_ctx.locator_set_key(loc);
RGWObjState *astate = NULL;
- ObjectCtx rctx(this);
+ RGWObjectCtx rctx(this);
int r = get_obj_state(&rctx, obj, &astate, NULL);
if (r < 0)
return r;
}
struct rgw_intent_log_entry entry;
- RGWRados::ObjectCtx obj_ctx(this);
+ RGWObjectCtx obj_ctx(this);
try {
::decode(entry, iter);
} catch (buffer::error& err) {
};
-class RGWRados
-{
- friend class RGWGC;
- friend class RGWStateLog;
- friend class RGWReplicaLogger;
+struct RGWObjectCtx {
+ RGWRados *store;
+ map<rgw_obj, RGWObjState> objs_state;
+ int (*intent_cb)(RGWRados *store, void *user_ctx, rgw_obj& obj, RGWIntentEvent intent);
+ void *user_ctx;
-public:
- struct ObjectCtx {
- RGWRados *store;
- map<rgw_obj, RGWObjState> objs_state;
- int (*intent_cb)(RGWRados *store, void *user_ctx, rgw_obj& obj, RGWIntentEvent intent);
- void *user_ctx;
+ RGWObjectCtx(RGWRados *_store) : store(_store), intent_cb(NULL), user_ctx(NULL) { }
+ RGWObjectCtx(RGWRados *_store, void *_user_ctx) : store(_store), intent_cb(NULL), user_ctx(_user_ctx) { }
- ObjectCtx(RGWRados *_store) : store(_store), intent_cb(NULL), user_ctx(NULL) { }
- ObjectCtx(RGWRados *_store, void *_user_ctx) : store(_store), intent_cb(NULL), user_ctx(_user_ctx) { }
+ RGWObjState *get_state(rgw_obj& obj);
+ void set_atomic(rgw_obj& obj);
+ void set_prefetch_data(rgw_obj& obj);
- RGWObjState *get_state(rgw_obj& obj);
- void set_atomic(rgw_obj& obj);
- void set_prefetch_data(rgw_obj& obj);
+ void set_intent_cb(int (*cb)(RGWRados *store, void *user_ctx, rgw_obj& obj, RGWIntentEvent intent)) {
+ intent_cb = cb;
+ }
- void set_intent_cb(int (*cb)(RGWRados *store, void *user_ctx, rgw_obj& obj, RGWIntentEvent intent)) {
- intent_cb = cb;
+ int notify_intent(RGWRados *store, rgw_obj& obj, RGWIntentEvent intent) {
+ if (intent_cb) {
+ return intent_cb(store, user_ctx, obj, intent);
}
+ return 0;
+ }
- int notify_intent(RGWRados *store, rgw_obj& obj, RGWIntentEvent intent) {
- if (intent_cb) {
- return intent_cb(store, user_ctx, obj, intent);
- }
- return 0;
- }
+ void invalidate(rgw_obj& obj);
+};
- void invalidate(rgw_obj& obj);
- };
+class RGWRados
+{
+ friend class RGWGC;
+ friend class RGWStateLog;
+ friend class RGWReplicaLogger;
-private:
/** Open the pool used as root for this gateway */
int open_root_pool_ctx();
int open_gc_pool_ctx();
int get_obj_ref(const rgw_obj& obj, rgw_rados_ref *ref, rgw_bucket *bucket, bool ref_system_obj = false);
uint64_t max_bucket_id;
- int get_olh_target_state(ObjectCtx& rctx, rgw_obj& obj, RGWObjState *olh_state,
+ int get_olh_target_state(RGWObjectCtx& rctx, rgw_obj& obj, RGWObjState *olh_state,
RGWObjState **target_state, RGWObjVersionTracker *objv_tracker);
- int get_obj_state_impl(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh);
- int append_atomic_test(ObjectCtx *rctx, rgw_obj& obj,
+ int get_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh);
+ int append_atomic_test(RGWObjectCtx *rctx, rgw_obj& obj,
librados::ObjectOperation& op, RGWObjState **state);
int update_placement_map();
class SystemObject {
RGWRados *store;
- RGWRados::ObjectCtx& ctx;
+ RGWObjectCtx& ctx;
rgw_obj obj;
RGWObjState *state;
int get_state(RGWObjState **pstate, RGWObjVersionTracker *objv_tracker);
public:
- SystemObject(RGWRados *_store, RGWRados::ObjectCtx& _ctx, rgw_obj& _obj) : store(_store), ctx(_ctx), obj(_obj), state(NULL) {}
+ SystemObject(RGWRados *_store, RGWObjectCtx& _ctx, rgw_obj& _obj) : store(_store), ctx(_ctx), obj(_obj), state(NULL) {}
RGWRados *get_store() { return store; }
rgw_obj& get_obj() { return obj; }
- RGWRados::ObjectCtx& get_ctx() { return ctx; }
+ RGWObjectCtx& get_ctx() { return ctx; }
struct Read {
RGWRados::SystemObject *source;
class Object {
RGWRados *store;
- RGWRados::ObjectCtx& ctx;
+ RGWObjectCtx& ctx;
rgw_obj obj;
RGWObjState *state;
int complete_atomic_modification();
public:
- Object(RGWRados *_store, RGWRados::ObjectCtx& _ctx, rgw_obj& _obj) : store(_store), ctx(_ctx), obj(_obj), state(NULL) {}
+ Object(RGWRados *_store, RGWObjectCtx& _ctx, rgw_obj& _obj) : store(_store), ctx(_ctx), obj(_obj), state(NULL) {}
RGWRados *get_store() { return store; }
rgw_obj& get_obj() { return obj; }
- RGWRados::ObjectCtx& get_ctx() { return ctx; }
+ RGWObjectCtx& get_ctx() { return ctx; }
struct Read {
RGWRados::Object *source;
* err: stores any errors resulting from the get of the original object
* Returns: 0 on success, -ERR# otherwise.
*/
- virtual int copy_obj(ObjectCtx& obj_ctx,
+ virtual int copy_obj(RGWObjectCtx& obj_ctx,
const string& user_id,
const string& client_id,
const string& op_id,
void (*progress_cb)(off_t, void *),
void *progress_data);
- int copy_obj_data(ObjectCtx& obj_ctx,
+ int copy_obj_data(RGWObjectCtx& obj_ctx,
RGWBucketInfo& dest_bucket_info,
RGWRados::Object::Read& read_op, off_t end,
rgw_obj& dest_obj,
int bucket_suspended(rgw_bucket& bucket, bool *suspended);
/** Delete an object.*/
- virtual int delete_obj(RGWRados::ObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& src_obj, bool use_versioning);
+ virtual int delete_obj(RGWObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& src_obj, bool use_versioning);
/* Delete a system object */
virtual int delete_system_obj(rgw_obj& src_obj, RGWObjVersionTracker *objv_tracker = NULL);
* dest: bufferlist to store the result in
* Returns: 0 on success, -ERR# otherwise.
*/
- virtual int get_attr(RGWRados::ObjectCtx& obj_ctx, rgw_obj& obj, const char *name, bufferlist& dest);
+ virtual int get_attr(RGWObjectCtx& obj_ctx, rgw_obj& obj, const char *name, bufferlist& dest);
/**
* Set an attr on an object.
map<string, bufferlist>* rmattrs,
RGWObjVersionTracker *objv_tracker);
- int get_obj_state(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh);
- int get_obj_state(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker) {
+ int get_obj_state(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh);
+ int get_obj_state(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker) {
return get_obj_state(rctx, obj, state, objv_tracker, true);
}
- virtual int stat_system_obj(RGWRados::ObjectCtx& obj_ctx,
+ virtual int stat_system_obj(RGWObjectCtx& obj_ctx,
RGWRados::SystemObject::Read::GetObjState& state,
rgw_obj& obj,
map<string, bufferlist> *attrs,
uint64_t *obj_size,
RGWObjVersionTracker *objv_tracker);
- virtual int get_system_obj(ObjectCtx& obj_ctx, RGWRados::SystemObject::Read::GetObjState& read_state,
+ virtual int get_system_obj(RGWObjectCtx& obj_ctx, RGWRados::SystemObject::Read::GetObjState& read_state,
RGWObjVersionTracker *objv_tracker, rgw_obj& obj,
bufferlist& bl, off_t ofs, off_t end,
rgw_cache_entry_info *cache_info);
int bucket_index_read_olh_log(RGWObjState *state, rgw_obj& obj_instance, uint64_t ver_marker,
map<uint64_t, rgw_bucket_olh_log_entry> *log, bool *is_truncated);
int bucket_index_trim_olh_log(rgw_obj& obj_instance, uint64_t ver);
- int apply_olh_log(ObjectCtx& ctx, const string& bucket_owner, rgw_obj& obj,
+ int apply_olh_log(RGWObjectCtx& ctx, const string& bucket_owner, rgw_obj& obj,
bufferlist& obj_tag, map<uint64_t, rgw_bucket_olh_log_entry>& log,
uint64_t *plast_ver);
- int update_olh(ObjectCtx& obj_ctx, RGWObjState *state, const string& bucket_owner, rgw_obj& obj);
- int set_olh(ObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& target_obj, bool delete_marker);
+ int update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const string& bucket_owner, rgw_obj& obj);
+ int set_olh(RGWObjectCtx& obj_ctx, const string& bucket_owner, rgw_obj& target_obj, bool delete_marker);
- int follow_olh(ObjectCtx& ctx, RGWObjState *state, rgw_obj& olh_obj, rgw_obj *target);
+ int follow_olh(RGWObjectCtx& ctx, RGWObjState *state, rgw_obj& olh_obj, rgw_obj *target);
int get_olh(rgw_obj& obj, RGWOLHInfo *olh);
void gen_rand_obj_instance_name(rgw_obj *target);
void pick_control_oid(const string& key, string& notify_oid);
void *create_context(void *user_ctx) {
- ObjectCtx *rctx = new ObjectCtx(this);
+ RGWObjectCtx *rctx = new RGWObjectCtx(this);
rctx->user_ctx = user_ctx;
return rctx;
}
void destroy_context(void *ctx) {
- delete static_cast<ObjectCtx *>(ctx);
+ delete static_cast<RGWObjectCtx *>(ctx);
}
void set_atomic(void *ctx, rgw_obj& obj) {
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
rctx->set_atomic(obj);
}
void set_prefetch_data(void *ctx, rgw_obj& obj) {
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
rctx->set_prefetch_data(obj);
}
// to notify upper layer that we need to do some operation on an object, and it's up to
// the upper layer to schedule this operation.. e.g., log intent in intent log
void set_intent_cb(void *ctx, int (*cb)(RGWRados *store, void *user_ctx, rgw_obj& obj, RGWIntentEvent intent)) {
- ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
rctx->set_intent_cb(cb);
}
int put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point, bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime,
map<string, bufferlist> *pattrs);
int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, time_t mtime, map<string, bufferlist> *pattrs);
- int get_bucket_entrypoint_info(ObjectCtx& obj_ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime,
+ int get_bucket_entrypoint_info(RGWObjectCtx& obj_ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime,
map<string, bufferlist> *pattrs, rgw_cache_entry_info *cache_info = NULL);
- int get_bucket_instance_info(ObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
- int get_bucket_instance_info(ObjectCtx& obj_ctx, rgw_bucket& bucket, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
- int get_bucket_instance_from_oid(ObjectCtx& obj_ctx, string& oid, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs,
+ int get_bucket_instance_info(RGWObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
+ int get_bucket_instance_info(RGWObjectCtx& obj_ctx, rgw_bucket& bucket, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
+ int get_bucket_instance_from_oid(RGWObjectCtx& obj_ctx, string& oid, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs,
rgw_cache_entry_info *cache_info = NULL);
- int convert_old_bucket_info(ObjectCtx& obj_ctx, string& bucket_name);
- virtual int get_bucket_info(ObjectCtx& obj_ctx, const string& bucket_name, RGWBucketInfo& info,
+ int convert_old_bucket_info(RGWObjectCtx& obj_ctx, string& bucket_name);
+ virtual int get_bucket_info(RGWObjectCtx& obj_ctx, const string& bucket_name, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs = NULL);
virtual int put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, time_t mtime, obj_version *pep_objv,
map<string, bufferlist> *pattrs, bool create_entry_point);
{
protected:
RGWRados *store;
- RGWRados::ObjectCtx& obj_ctx;
+ RGWObjectCtx& obj_ctx;
bool is_complete;
string bucket_owner;
const char *if_match = NULL, const char *if_nomatch = NULL) = 0;
public:
- RGWPutObjProcessor(RGWRados::ObjectCtx& _obj_ctx, const string& _bo) : store(NULL), obj_ctx(_obj_ctx), is_complete(false), bucket_owner(_bo) {}
+ RGWPutObjProcessor(RGWObjectCtx& _obj_ctx, const string& _bo) : store(NULL), obj_ctx(_obj_ctx), is_complete(false), bucket_owner(_bo) {}
virtual ~RGWPutObjProcessor() {}
virtual int prepare(RGWRados *_store, string *oid_rand) {
store = _store;
public:
int throttle_data(void *handle, bool need_to_wait);
- RGWPutObjProcessor_Aio(RGWRados::ObjectCtx& obj_ctx, const string& bucket_owner) : RGWPutObjProcessor(obj_ctx, bucket_owner), max_chunks(RGW_MAX_PENDING_CHUNKS), obj_len(0) {}
+ RGWPutObjProcessor_Aio(RGWObjectCtx& obj_ctx, const string& bucket_owner) : RGWPutObjProcessor(obj_ctx, bucket_owner), max_chunks(RGW_MAX_PENDING_CHUNKS), obj_len(0) {}
virtual ~RGWPutObjProcessor_Aio();
};
public:
~RGWPutObjProcessor_Atomic() {}
- RGWPutObjProcessor_Atomic(RGWRados::ObjectCtx& obj_ctx, const string& bucket_owner,
+ RGWPutObjProcessor_Atomic(RGWObjectCtx& obj_ctx, const string& bucket_owner,
rgw_bucket& _b, const string& _o, uint64_t _p, const string& _t, bool versioned) :
RGWPutObjProcessor_Aio(obj_ctx, bucket_owner),
part_size(_p),
return ret;
}
-int rgw_get_system_obj(RGWRados *rgwstore, RGWRados::ObjectCtx& obj_ctx, rgw_bucket& bucket, const string& key, bufferlist& bl,
+int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, rgw_bucket& bucket, const string& key, bufferlist& bl,
RGWObjVersionTracker *objv_tracker, time_t *pmtime, map<string, bufferlist> *pattrs,
rgw_cache_entry_info *cache_info)
{
#include "rgw_common.h"
class RGWRados;
+class RGWObjectCtx;
struct RGWObjVersionTracker;
struct obj_version;
int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, const char *data, size_t size, bool exclusive,
RGWObjVersionTracker *objv_tracker, time_t set_mtime, map<string, bufferlist> *pattrs = NULL);
-int rgw_get_system_obj(RGWRados *rgwstore, RGWRados::ObjectCtx& obj_ctx, rgw_bucket& bucket, const string& key, bufferlist& bl,
+int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, rgw_bucket& bucket, const string& key, bufferlist& bl,
RGWObjVersionTracker *objv_tracker, time_t *pmtime, map<string, bufferlist> *pattrs = NULL,
rgw_cache_entry_info *cache_info = NULL);