extra_params.set_mtime = set_mtime;
extra_params.owner = bucket_owner;
- RGWRados::RGWRadosCtx *rctx = static_cast<RGWRados::RGWRadosCtx *>(obj_ctx);
+ RGWRados::ObjectCtx *rctx = static_cast<RGWRados::ObjectCtx *>(obj_ctx);
bool is_olh = false;
if (head_obj.get_instance().empty()) {
}
};
-RGWObjState *RGWRados::RGWRadosCtx::get_state(rgw_obj& obj) {
+RGWObjState *RGWRados::ObjectCtx::get_state(rgw_obj& obj) {
if (!obj.get_object().empty()) {
return &objs_state[obj];
} else {
}
}
-void RGWRados::RGWRadosCtx::invalidate(rgw_obj& obj)
+void RGWRados::ObjectCtx::invalidate(rgw_obj& obj)
{
objs_state.erase(obj);
}
-void RGWRados::RGWRadosCtx::set_atomic(rgw_obj& obj) {
+void RGWRados::ObjectCtx::set_atomic(rgw_obj& obj) {
if (!obj.get_object().empty()) {
objs_state[obj].is_atomic = true;
} else {
}
}
-void RGWRados::RGWRadosCtx::set_prefetch_data(rgw_obj& obj) {
+void RGWRados::ObjectCtx::set_prefetch_data(rgw_obj& obj) {
if (!obj.get_object().empty()) {
objs_state[obj].prefetch_data = true;
} else {
if (r < 0)
return r;
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
ObjectWriteOperation op;
time_t mtime;
uint64_t total_len;
uint64_t obj_size;
- RGWRadosCtx rctx(this);
+ ObjectCtx rctx(this);
int ret = prepare_get_obj((void *)&rctx, obj, &ofs, &end, &attrset,
NULL, NULL, &mtime, NULL, NULL, &total_len,
&obj_size, NULL, &handle, NULL);
RGWObjManifest manifest;
RGWObjState *astate = NULL;
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
ret = get_obj_state(rctx, src_obj, &astate, NULL);
if (ret < 0)
return ret;
return 0;
}
-int RGWRados::complete_atomic_overwrite(RGWRadosCtx *rctx, RGWObjState *state, rgw_obj& obj)
+int RGWRados::complete_atomic_overwrite(ObjectCtx *rctx, RGWObjState *state, rgw_obj& obj)
{
if (!state || !state->has_manifest || state->keep_tail)
return 0;
int RGWRados::defer_gc(void *ctx, rgw_obj& obj)
{
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
rgw_bucket bucket;
std::string oid, key;
get_obj_bucket_and_oid_loc(obj, bucket, oid, key);
if (r < 0) {
return r;
}
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
ObjectWriteOperation op;
return (iter != attrs.end());
}
-int RGWRados::get_olh_target_state(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState *olh_state,
+int RGWRados::get_olh_target_state(ObjectCtx *rctx, 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(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
+int RGWRados::get_obj_state_impl(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
{
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;
return 0;
}
-int RGWRados::get_obj_state(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
+int RGWRados::get_obj_state(ObjectCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh)
{
int ret;
if (r < 0) {
return r;
}
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
if (rctx) {
RGWObjState *state;
return 0;
}
-int RGWRados::append_atomic_test(RGWRadosCtx *rctx, rgw_obj& obj,
+int RGWRados::append_atomic_test(ObjectCtx *rctx, rgw_obj& obj,
ObjectOperation& op, RGWObjState **pstate)
{
if (!rctx)
return 0;
}
-int RGWRados::prepare_atomic_for_write_impl(RGWRadosCtx *rctx, rgw_obj& obj,
+int RGWRados::prepare_atomic_for_write_impl(ObjectCtx *rctx, rgw_obj& obj,
ObjectWriteOperation& op, RGWObjState **pstate,
bool reset_obj, const string *ptag,
const char *if_match, const char *if_nomatch)
return 0;
}
-int RGWRados::prepare_atomic_for_write(RGWRadosCtx *rctx, rgw_obj& obj,
+int RGWRados::prepare_atomic_for_write(ObjectCtx *rctx, rgw_obj& obj,
ObjectWriteOperation& op, RGWObjState **pstate,
bool reset_obj, const string *ptag,
const char *if_match, const char *if_nomatch)
if (r < 0) {
return r;
}
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
ObjectWriteOperation op;
RGWObjState *state = NULL;
{
bufferlist etag;
time_t ctime;
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
- RGWRadosCtx *new_ctx = NULL;
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ ObjectCtx *new_ctx = NULL;
RGWObjState *astate = NULL;
off_t ofs = 0;
off_t end = -1;
}
if (!rctx) {
- new_ctx = new RGWRadosCtx(this);
+ new_ctx = new ObjectCtx(this);
rctx = new_ctx;
}
rgw_obj read_obj = obj;
uint64_t read_ofs = ofs;
uint64_t len, read_len;
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
- RGWRadosCtx *new_ctx = NULL;
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ ObjectCtx *new_ctx = NULL;
bool reading_from_head = true;
ObjectReadOperation op;
get_obj_bucket_and_oid_loc(obj, bucket, oid, key);
if (!rctx) {
- new_ctx = new RGWRadosCtx(this);
+ new_ctx = new ObjectCtx(this);
rctx = new_ctx;
}
off_t read_ofs, off_t len,
bool is_head_obj, void *arg)
{
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(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;
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
- RGWRadosCtx *new_ctx = NULL;
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
+ ObjectCtx *new_ctx = NULL;
bool reading_from_head = true;
RGWObjState *astate = NULL;
if (!rctx) {
- new_ctx = new RGWRadosCtx(this);
+ new_ctx = new ObjectCtx(this);
rctx = new_ctx;
}
if (r < 0) {
return r;
}
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
RGWObjState *astate = NULL;
ObjectReadOperation op;
olh_obj.clear_instance();
RGWObjState *state = NULL;
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
int ret;
io_ctx.locator_set_key(loc);
RGWObjState *astate = NULL;
- RGWRadosCtx rctx(this);
+ ObjectCtx rctx(this);
int r = get_obj_state(&rctx, obj, &astate, NULL);
if (r < 0)
return r;
friend class RGWReplicaLogger;
public:
- struct RGWRadosCtx {
+ 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;
- RGWRadosCtx(RGWRados *_store) : store(_store), intent_cb(NULL), user_ctx(NULL) { }
- RGWRadosCtx(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);
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(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState *olh_state,
+ int get_olh_target_state(ObjectCtx *rctx, rgw_obj& obj, RGWObjState *olh_state,
RGWObjState **target_state, RGWObjVersionTracker *objv_tracker);
- int get_obj_state_impl(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh);
- int append_atomic_test(RGWRadosCtx *rctx, rgw_obj& obj,
+ 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,
librados::ObjectOperation& op, RGWObjState **state);
- int prepare_atomic_for_write_impl(RGWRadosCtx *rctx, rgw_obj& obj,
+ int prepare_atomic_for_write_impl(ObjectCtx *rctx, rgw_obj& obj,
librados::ObjectWriteOperation& op, RGWObjState **pstate,
bool reset_obj, const string *ptag,
const char *if_match = NULL,
const char *if_nomatch = NULL);
- int prepare_atomic_for_write(RGWRadosCtx *rctx, rgw_obj& obj,
+ int prepare_atomic_for_write(ObjectCtx *rctx, rgw_obj& obj,
librados::ObjectWriteOperation& op, RGWObjState **pstate,
bool reset_obj, const string *ptag,
const char *if_match = NULL,
}
}
- int complete_atomic_overwrite(RGWRadosCtx *rctx, RGWObjState *state, rgw_obj& obj);
+ int complete_atomic_overwrite(ObjectCtx *rctx, RGWObjState *state, rgw_obj& obj);
int update_placement_map();
int store_bucket_info(RGWBucketInfo& info, map<string, bufferlist> *pattrs, RGWObjVersionTracker *objv_tracker, bool exclusive);
map<string, bufferlist>* rmattrs,
RGWObjVersionTracker *objv_tracker);
- int get_obj_state(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker, bool follow_olh);
- int get_obj_state(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState **state, 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) {
return get_obj_state(rctx, obj, state, objv_tracker, true);
}
/**
void pick_control_oid(const string& key, string& notify_oid);
void *create_context(void *user_ctx) {
- RGWRadosCtx *rctx = new RGWRadosCtx(this);
+ ObjectCtx *rctx = new ObjectCtx(this);
rctx->user_ctx = user_ctx;
return rctx;
}
void destroy_context(void *ctx) {
- delete static_cast<RGWRadosCtx *>(ctx);
+ delete static_cast<ObjectCtx *>(ctx);
}
void set_atomic(void *ctx, rgw_obj& obj) {
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
rctx->set_atomic(obj);
}
void set_prefetch_data(void *ctx, rgw_obj& obj) {
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(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)) {
- RGWRadosCtx *rctx = static_cast<RGWRadosCtx *>(ctx);
+ ObjectCtx *rctx = static_cast<ObjectCtx *>(ctx);
rctx->set_intent_cb(cb);
}