}
void cls_rgw_bucket_prepare_op(ObjectWriteOperation& o, RGWModifyOp op, string& tag,
- string& name, string& locator, bool log_op)
+ const string& name, const string& instance, const string& locator, bool log_op)
{
struct rgw_cls_obj_prepare_op call;
call.op = op;
call.name = name;
call.locator = locator;
call.log_op = log_op;
+ call.instance = instance;
bufferlist in;
::encode(call, in);
o.exec("rgw", "bucket_prepare_op", in);
}
void cls_rgw_bucket_complete_op(ObjectWriteOperation& o, RGWModifyOp op, string& tag,
- rgw_bucket_entry_ver& ver, string& name, rgw_bucket_dir_entry_meta& dir_meta,
+ rgw_bucket_entry_ver& ver,
+ const string& name, const string& instance,
+ rgw_bucket_dir_entry_meta& dir_meta,
list<string> *remove_objs, bool log_op)
{
call.ver = ver;
call.meta = dir_meta;
call.log_op = log_op;
+ call.instance = instance;
if (remove_objs)
call.remove_objs = *remove_objs;
::encode(call, in);
void cls_rgw_bucket_set_tag_timeout(librados::ObjectWriteOperation& o, uint64_t tag_timeout);
void cls_rgw_bucket_prepare_op(librados::ObjectWriteOperation& o, RGWModifyOp op, string& tag,
- string& name, string& locator, bool log_op);
+ const string& name, const string& instance, const string& locator, bool log_op);
void cls_rgw_bucket_complete_op(librados::ObjectWriteOperation& o, RGWModifyOp op, string& tag,
- rgw_bucket_entry_ver& ver, string& name, rgw_bucket_dir_entry_meta& dir_meta,
+ rgw_bucket_entry_ver& ver,
+ const string& name, const string& instance,
+ rgw_bucket_dir_entry_meta& dir_meta,
list<string> *remove_objs, bool log_op);
int cls_rgw_list_op(librados::IoCtx& io_ctx, string& oid, string& start_obj,
meta.dump(f);
f->close_section();
f->dump_string("tag", tag);
+ f->dump_string("instance", instance);
}
void rgw_cls_list_op::generate_test_instances(list<rgw_cls_list_op*>& o)
string tag;
string locator;
bool log_op;
+ string instance;
rgw_cls_obj_prepare_op() : op(CLS_RGW_OP_UNKNOWN), log_op(false) {}
void encode(bufferlist &bl) const {
- ENCODE_START(4, 3, bl);
+ ENCODE_START(5, 3, bl);
uint8_t c = (uint8_t)op;
::encode(c, bl);
::encode(name, bl);
::encode(tag, bl);
::encode(locator, bl);
::encode(log_op, bl);
+ ::encode(instance, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator &bl) {
- DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl);
uint8_t c;
::decode(c, bl);
op = (RGWModifyOp)c;
if (struct_v >= 4) {
::decode(log_op, bl);
}
+ if (struct_v >= 5) {
+ ::decode(instance, bl);
+ }
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
struct rgw_bucket_dir_entry_meta meta;
string tag;
bool log_op;
+ string instance;
list<string> remove_objs;
rgw_cls_obj_complete_op() : op(CLS_RGW_OP_ADD), log_op(false) {}
void encode(bufferlist &bl) const {
- ENCODE_START(6, 3, bl);
+ ENCODE_START(7, 3, bl);
uint8_t c = (uint8_t)op;
::encode(c, bl);
::encode(name, bl);
::encode(remove_objs, bl);
::encode(ver, bl);
::encode(log_op, bl);
+ ::encode(instance, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator &bl) {
if (struct_v >= 6) {
::decode(log_op, bl);
}
+ if (struct_v >= 7) {
+ ::decode(instance, bl);
+ }
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
static bool bucket_object_check_filter(const string& name)
{
string ns;
+ string ver;
string obj = name;
- return rgw_obj::translate_raw_obj_to_obj_in_ns(obj, ns);
+ return rgw_obj::translate_raw_obj_to_obj_in_ns(obj, ns, ver);
}
int rgw_remove_object(RGWRados *store, const string& bucket_owner, rgw_bucket& bucket, std::string& object)
for (iter = result.begin(); iter != result.end(); ++iter) {
RGWObjEnt& ent = *iter;
- rgw_obj obj(bucket, ent.name);
- obj.set_ns(ns);
+ rgw_obj obj(bucket, ent.name, ns);
+ obj.set_instance(ent.instance);
- string& oid = obj.object;
+ string oid = obj.get_index_key();
+#warning missing marker_ver
marker = oid;
int pos = oid.find_last_of('.');
return T::list_objects_raw_next(obj, handle);
}
- string normal_name(rgw_bucket& bucket, std::string& oid) {
+ string normal_name(rgw_bucket& bucket, const std::string& oid) {
string& bucket_name = bucket.name;
char buf[bucket_name.size() + 1 + oid.size() + 1];
const char *bucket_str = bucket_name.c_str();
return string(buf);
}
- void normalize_bucket_and_obj(rgw_bucket& src_bucket, string& src_obj, rgw_bucket& dst_bucket, string& dst_obj);
+ void normalize_bucket_and_obj(rgw_bucket& src_bucket, const string& src_obj, rgw_bucket& dst_bucket, string& dst_obj);
string normal_name(rgw_obj& obj) {
- return normal_name(obj.bucket, obj.object);
+ return normal_name(obj.bucket, obj.get_object());
}
int init_rados() {
};
template <class T>
-void RGWCache<T>::normalize_bucket_and_obj(rgw_bucket& src_bucket, string& src_obj, rgw_bucket& dst_bucket, string& dst_obj)
+void RGWCache<T>::normalize_bucket_and_obj(rgw_bucket& src_bucket, const string& src_obj, rgw_bucket& dst_bucket, string& dst_obj)
{
if (src_obj.size()) {
dst_bucket = src_bucket;
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
if (bucket.name[0] != '.')
return T::delete_obj_impl(ctx, bucket_owner, obj, objv_tracker);
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
if (bucket.name[0] != '.' || ofs != 0)
return T::get_obj(ctx, objv_tracker, handle, obj, obl, ofs, end, cache_info);
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
ObjectCacheInfo info;
bool cacheable = false;
if (bucket.name[0] == '.') {
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
ObjectCacheInfo info;
bool cacheable = false;
if (bucket.name[0] == '.') {
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
ObjectCacheInfo info;
bool cacheable = false;
if (bucket.name[0] == '.') {
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
ObjectCacheInfo info;
bool cacheable = false;
if ((bucket.name[0] == '.') && ((ofs == 0) || (ofs == -1))) {
{
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
+ normalize_bucket_and_obj(obj.bucket, obj.get_object(), bucket, oid);
if (bucket.name[0] != '.')
return T::obj_stat(ctx, obj, psize, pmtime, pepoch, attrs, first_chunk, objv_tracker);
rgw_bucket bucket;
string oid;
- normalize_bucket_and_obj(info.obj.bucket, info.obj.object, bucket, oid);
+ normalize_bucket_and_obj(info.obj.bucket, info.obj.get_object(), bucket, oid);
string name = normal_name(bucket, oid);
switch (info.op) {
string etag;
string content_type;
string tag;
+ string instance;
RGWObjEnt() : size(0) {}
class rgw_obj {
std::string orig_obj;
std::string orig_key;
+ std::string key;
+ std::string object;
+ std::string instance;
public:
+ const std::string& get_object() const { return object; }
+ const std::string& get_key() const { return key; }
+ const std::string& get_instance() const { return instance; }
rgw_bucket bucket;
- std::string key;
std::string ns;
- std::string object;
bool in_extra_data; /* in-memory only member, does not serialize */
set_obj(orig_obj);
return 0;
}
+ void set_instance(const string& i) {
+ if (i[0] == '_')
+ return -EINVAL;
+ instance = i;
+ set_obj(orig_obj);
+ }
void set_key(const string& k) {
orig_key = k;
} else {
object = "_";
object.append(ns);
+ if (!instance.empty()) {
+ object.append(string(":") + instance);
+ }
object.append("_");
object.append(o);
}
set_key(orig_obj);
}
+ /*
+ * get the object's key name as being referred to by the bucket index. Note that
+ * this doesn't include the object version portion, as it's passed separately to the
+ * index.
+ */
+ string get_index_key() {
+ if (ns.empty()) {
+ if (orig_obj.size() < 1 || orig_obj[0] != '_') {
+ return orig_obj;
+ }
+ return string("_") + orig_obj;
+ };
+
+ char buf[ns.size() + 16];
+ snprintf(buf, sizeof(buf), "_%s_", ns.c_str());
+ return string(buf) + orig_obj;
+ };
+
+ static void parse_ns_field(string& ns, string& instance) {
+ int pos = ns.find(':');
+ if (pos >= 0) {
+ instance = ns.substr(pos + 1);
+ ns = ns.substr(0, pos);
+ } else {
+ instance.clear();
+ }
+ }
+
/**
* Translate a namespace-mangled object name to the user-facing name
* existing in the given namespace.
* and cuts down the name to the unmangled version. If it is not
* part of the given namespace, it returns false.
*/
- static bool translate_raw_obj_to_obj_in_ns(string& obj, string& ns) {
+ static bool translate_raw_obj_to_obj_in_ns(string& obj, string& instance, string& ns) {
if (ns.empty()) {
if (obj[0] != '_')
return true;
return false;
string obj_ns = obj.substr(1, pos - 1);
+ parse_ns_field(obj_ns, instance);
if (obj_ns.compare(ns) != 0)
return false;
* It returns true after successfully doing so, or
* false if it fails.
*/
- static bool strip_namespace_from_object(string& obj, string& ns) {
+ static bool strip_namespace_from_object(string& obj, string& ns, string& instance) {
ns.clear();
+ instance.clear();
if (obj[0] != '_') {
return true;
}
ns = obj.substr(1, pos-1);
obj = obj.substr(pos+1, string::npos);
+
+ parse_ns_field(ns, instance);
return true;
}
}
void encode(bufferlist& bl) const {
- ENCODE_START(3, 3, bl);
+ ENCODE_START(4, 3, bl);
::encode(bucket.name, bl);
::encode(key, bl);
::encode(ns, bl);
::encode(object, bl);
::encode(bucket, bl);
+ ::encode(instance, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
- DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl);
::decode(bucket.name, bl);
::decode(key, bl);
::decode(ns, bl);
::decode(object, bl);
if (struct_v >= 2)
::decode(bucket, bl);
+ if (struct_v >= 4)
+ ::decode(instance, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
bool operator==(const rgw_obj& o) const {
return (object.compare(o.object) == 0) &&
(bucket.name.compare(o.bucket.name) == 0) &&
- (ns.compare(o.ns) == 0);
+ (ns.compare(o.ns) == 0) &&
+ (instance.compare(o.instance) == 0);
}
bool operator<(const rgw_obj& o) const {
int r = bucket.name.compare(o.bucket.name);
r = object.compare(o.object);
if (r == 0) {
r = ns.compare(o.ns);
+ if (r == 0) {
+ r = instance.compare(o.instance);
+ }
}
}
};
inline ostream& operator<<(ostream& out, const rgw_obj &o) {
- return out << o.bucket.name << ":" << o.object;
+ return out << o.bucket.name << ":" << o.get_object();
}
static inline bool str_startswith(const string& str, const string& prefix)
strcasecmp(s, "1") == 0);
}
-static inline void append_rand_alpha(CephContext *cct, string& src, string& dest, int len)
+static inline void append_rand_alpha(CephContext *cct, const string& src, string& dest, int len)
{
dest = src;
char buf[len + 1];
return 0;
}
- if (obj.object.empty()) {
+ if (obj.get_object().empty()) {
rgw_obj instance_obj;
store->get_bucket_instance_obj(bucket_info.bucket, instance_obj);
return get_bucket_policy_from_attr(cct, store, ctx, bucket_info, bucket_attrs,
manifest.append(obj_part.manifest);
}
- remove_objs.push_back(src_obj.object);
+ remove_objs.push_back(src_obj.get_index_key());
ofs += obj_part.size;
}
extra_params.owner = bucket_owner;
if (versioned_object) {
- rgw_obj ver_head_obj(head_obj.bucket, head_obj.object, "ver");
+ rgw_obj ver_head_obj = head_obj;
+
+ ver_head_obj.set_instance("instance");
r = store->put_obj_meta(NULL, ver_head_obj, obj_len, attrs,
RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE,
};
RGWObjState *RGWRadosCtx::get_state(rgw_obj& obj) {
- if (obj.object.size()) {
+ if (!obj.get_object().empty()) {
return &objs_state[obj];
} else {
rgw_obj new_obj(store->zone.domain_root, obj.bucket.name);
}
void RGWRadosCtx::set_atomic(rgw_obj& obj) {
- if (obj.object.size()) {
+ if (!obj.get_object().empty()) {
objs_state[obj].is_atomic = true;
} else {
rgw_obj new_obj(store->zone.domain_root, obj.bucket.name);
}
void RGWRadosCtx::set_prefetch_data(rgw_obj& obj) {
- if (obj.object.size()) {
+ if (!obj.get_object().empty()) {
objs_state[obj].prefetch_data = true;
} else {
rgw_obj new_obj(store->zone.domain_root, obj.bucket.name);
rgw_obj marker_obj, prefix_obj;
marker_obj.set_ns(ns);
marker_obj.set_obj(marker);
- string cur_marker = marker_obj.object;
+#warning missing marker_ver
+ string cur_marker = marker_obj.get_index_key();
prefix_obj.set_ns(ns);
prefix_obj.set_obj(prefix);
- string cur_prefix = prefix_obj.object;
+ string cur_prefix = prefix_obj.get_index_key();
string bigger_than_delim;
for (eiter = ent_map.begin(); eiter != ent_map.end(); ++eiter) {
string obj = eiter->first;
string key = obj;
+ string instance;
- bool check_ns = rgw_obj::translate_raw_obj_to_obj_in_ns(obj, ns);
+ bool check_ns = rgw_obj::translate_raw_obj_to_obj_in_ns(obj, instance, ns);
if (enforce_ns && !check_ns) {
if (!ns.empty()) {
ldout(cct, 0) << "ERROR: complete_atomic_overwrite returned r=" << r << dendl;
}
- r = complete_update_index(bucket, obj.object, index_tag, poolid, epoch, size,
+ r = complete_update_index(bucket, obj, index_tag, poolid, epoch, size,
ut, etag, content_type, &acl_bl, category, remove_objs);
if (r < 0)
goto done_cancel;
return 0;
done_cancel:
- int ret = complete_update_index_cancel(bucket, obj.object, index_tag);
+ int ret = complete_update_index_cancel(bucket, obj, index_tag);
if (ret < 0) {
ldout(cct, 0) << "ERROR: complete_update_index_cancel() returned ret=" << ret << dendl;
}
bool remote_src;
bool remote_dest;
- append_rand_alpha(cct, dest_obj.object, shadow_oid, 32);
+ append_rand_alpha(cct, dest_obj.get_object(), shadow_oid, 32);
shadow_obj.init_ns(dest_obj.bucket, shadow_oid, shadow_ns);
remote_dest = !region.equals(dest_bucket_info.region);
return -EINVAL;
}
- ldout(cct, 5) << "Copy object " << src_obj.bucket << ":" << src_obj.object << " => " << dest_obj.bucket << ":" << dest_obj.object << dendl;
+ ldout(cct, 5) << "Copy object " << src_obj.bucket << ":" << src_obj.get_object() << " => " << dest_obj.bucket << ":" << dest_obj.get_object() << dendl;
void *handle = NULL;
GetObjHandleDestructor handle_destructor(this);
string tag;
append_rand_alpha(cct, tag, tag, 32);
- RGWPutObjProcessor_Atomic processor(dest_bucket_info.owner, dest_obj.bucket, dest_obj.object,
+ RGWPutObjProcessor_Atomic processor(dest_bucket_info.owner, dest_obj.bucket, dest_obj.get_object(),
cct->_conf->rgw_obj_stripe_size, tag, dest_bucket_info.versioning_enabled);
ret = processor.prepare(this, ctx, NULL);
if (ret < 0)
conn = iter->second;
}
- string obj_name = dest_obj.bucket.name + "/" + dest_obj.object;
+ string obj_name = dest_obj.bucket.name + "/" + dest_obj.get_object();
RGWOpStateSingleOp opstate(this, client_id, op_id, obj_name);
string tag;
append_rand_alpha(cct, tag, tag, 32);
- RGWPutObjProcessor_Atomic processor(owner, dest_obj.bucket, dest_obj.object,
+ RGWPutObjProcessor_Atomic processor(owner, dest_obj.bucket, dest_obj.get_object(),
cct->_conf->rgw_obj_stripe_size, tag);
int ret = processor.prepare(this, ctx, NULL);
if (ret < 0)
string ns;
std::map<string, RGWObjEnt>::iterator eiter;
string obj;
+ string instance;
for (eiter = ent_map.begin(); eiter != ent_map.end(); ++eiter) {
obj = eiter->first;
- if (rgw_obj::translate_raw_obj_to_obj_in_ns(obj, ns))
+ if (rgw_obj::translate_raw_obj_to_obj_in_ns(obj, instance, ns))
return -ENOTEMPTY;
}
} while (is_truncated);
int64_t poolid = ref.ioctx.get_id();
if (r >= 0 || r == -ENOENT) {
uint64_t epoch = ref.ioctx.get_last_version();
- r = complete_update_index_del(bucket, obj.object, tag, poolid, epoch);
+ r = complete_update_index_del(bucket, obj, tag, poolid, epoch);
} else {
- int ret = complete_update_index_cancel(bucket, obj.object, tag);
+ int ret = complete_update_index_cancel(bucket, obj, tag);
if (ret < 0) {
ldout(cct, 0) << "ERROR: complete_update_index_cancel returned ret=" << ret << dendl;
}
get_obj_bucket_and_oid_key(obj, bucket, oid, key);
string tag;
- int r = complete_update_index_del(bucket, obj.object, tag, -1 /* pool */, 0);
+ int r = complete_update_index_del(bucket, obj, tag, -1 /* pool */, 0);
return r;
}
if (mi != manifest.obj_end()) {
if (manifest.has_tail()) // first object usually points at the head, let's skip to a more unique part
++mi;
- tag = mi.get_location().object;
+ tag = mi.get_location().get_object();
tag.append("_");
}
append_rand_alpha(cct, tag, tag, 32);
}
}
- ret = cls_obj_prepare_op(bucket, op, tag,
- obj.object, obj.key);
+ ret = cls_obj_prepare_op(bucket, op, tag, obj);
return ret;
}
-int RGWRados::complete_update_index(rgw_bucket& bucket, string& oid, string& tag, int64_t poolid, uint64_t epoch, uint64_t size,
+int RGWRados::complete_update_index(rgw_bucket& bucket, rgw_obj& obj, string& tag, int64_t poolid, uint64_t epoch, uint64_t size,
utime_t& ut, string& etag, string& content_type, bufferlist *acl_bl, RGWObjCategory category,
list<string> *remove_objs)
{
return 0;
RGWObjEnt ent;
- ent.name = oid;
+ ent.name = obj.get_index_key();
+ ent.instance = obj.get_instance();
ent.size = size;
ent.mtime = ut;
ent.etag = etag;
range.len += next.len;
}
if (range.len) {
- ldout(cct, 20) << "calling op.clone_range(dst_ofs=" << range.dst_ofs << ", src.object=" << range.src.object << " range.src_ofs=" << range.src_ofs << " range.len=" << range.len << dendl;
+ ldout(cct, 20) << "calling op.clone_range(dst_ofs=" << range.dst_ofs << ", src.object=" << range.src.get_object()
+ << " range.src_ofs=" << range.src_ofs << " range.len=" << range.len << dendl;
if (xattr_cond) {
string src_cmp_obj, src_cmp_key;
get_obj_bucket_and_oid_key(range.src, bucket, src_cmp_obj, src_cmp_key);
if (update_index) {
if (ret >= 0) {
- ret = complete_update_index(bucket, dst_obj.object, tag, poolid, epoch, size,
+ ret = complete_update_index(bucket, dst_obj, tag, poolid, epoch, size,
ut, etag, content_type, &acl_bl, category, NULL);
} else {
- int r = complete_update_index_cancel(bucket, dst_obj.object, tag);
+ int r = complete_update_index_cancel(bucket, dst_obj, tag);
if (r < 0) {
ldout(cct, 0) << "ERROR: comlete_update_index_cancel() returned r=" << r << dendl;
}
}
int RGWRados::cls_obj_prepare_op(rgw_bucket& bucket, RGWModifyOp op, string& tag,
- string& name, string& locator)
+ rgw_obj& obj)
{
librados::IoCtx index_ctx;
string oid;
return r;
ObjectWriteOperation o;
- cls_rgw_bucket_prepare_op(o, op, tag, name, locator, zone_public_config.log_data);
+ cls_rgw_bucket_prepare_op(o, op, tag, obj.get_index_key(), obj.get_instance(), obj.get_key(), zone_public_config.log_data);
r = index_ctx.operate(oid, &o);
return r;
}
rgw_bucket_entry_ver ver;
ver.pool = pool;
ver.epoch = epoch;
- cls_rgw_bucket_complete_op(o, op, tag, ver, ent.name, dir_meta, remove_objs, zone_public_config.log_data);
+ cls_rgw_bucket_complete_op(o, op, tag, ver, ent.name, ent.instance, dir_meta, remove_objs, zone_public_config.log_data);
AioCompletion *c = librados::Rados::aio_create_completion(NULL, NULL, NULL);
r = index_ctx.aio_operate(oid, c, &o);
int RGWRados::cls_obj_complete_del(rgw_bucket& bucket, string& tag,
int64_t pool, uint64_t epoch,
- string& name)
+ rgw_obj& obj)
{
RGWObjEnt ent;
- ent.name = name;
+ ent.name = obj.get_index_key();
+ ent.instance = obj.get_instance();
return cls_obj_complete_op(bucket, CLS_RGW_OP_DEL, tag, pool, epoch, ent, RGW_OBJ_CATEGORY_NONE, NULL);
}
-int RGWRados::cls_obj_complete_cancel(rgw_bucket& bucket, string& tag, string& name)
+int RGWRados::cls_obj_complete_cancel(rgw_bucket& bucket, string& tag, rgw_obj& obj)
{
RGWObjEnt ent;
- ent.name = name;
+ ent.name = obj.get_index_key();
+ ent.instance = obj.get_instance();
return cls_obj_complete_op(bucket, CLS_RGW_OP_ADD, tag, -1 /* pool id */, 0, ent, RGW_OBJ_CATEGORY_NONE, NULL);
}
bufferlist& suggested_updates)
{
rgw_obj obj;
- std::string oid, key, ns;
+ std::string oid, instance, key, ns;
oid = list_state.name;
- if (!rgw_obj::strip_namespace_from_object(oid, ns)) {
+ if (!rgw_obj::strip_namespace_from_object(oid, ns, instance)) {
// well crap
assert(0 == "got bad object name off disk");
}
obj.init(bucket, oid, list_state.locator, ns);
+ obj.set_instance(instance);
get_obj_bucket_and_oid_key(obj, bucket, oid, key);
io_ctx.locator_set_key(key);
static inline void get_obj_bucket_and_oid_key(const rgw_obj& obj, rgw_bucket& bucket, string& oid, string& key)
{
bucket = obj.bucket;
- prepend_bucket_marker(bucket, obj.object, oid);
- prepend_bucket_marker(bucket, obj.key, key);
+ prepend_bucket_marker(bucket, obj.get_object(), oid);
+ prepend_bucket_marker(bucket, obj.get_key(), key);
}
int rgw_policy_from_attrset(CephContext *cct, map<string, bufferlist>& attrset, RGWAccessControlPolicy *policy);
int cls_rgw_init_index(librados::IoCtx& io_ctx, librados::ObjectWriteOperation& op, string& oid);
int cls_obj_prepare_op(rgw_bucket& bucket, RGWModifyOp op, string& tag,
- string& name, string& locator);
+ rgw_obj& obj);
int cls_obj_complete_op(rgw_bucket& bucket, RGWModifyOp op, string& tag, int64_t pool, uint64_t epoch,
RGWObjEnt& ent, RGWObjCategory category, list<string> *remove_objs);
int cls_obj_complete_add(rgw_bucket& bucket, string& tag, int64_t pool, uint64_t epoch, RGWObjEnt& ent, RGWObjCategory category, list<string> *remove_objs);
- int cls_obj_complete_del(rgw_bucket& bucket, string& tag, int64_t pool, uint64_t epoch, string& name);
- int cls_obj_complete_cancel(rgw_bucket& bucket, string& tag, string& name);
+ int cls_obj_complete_del(rgw_bucket& bucket, string& tag, int64_t pool, uint64_t epoch, rgw_obj& obj);
+ int cls_obj_complete_cancel(rgw_bucket& bucket, string& tag, rgw_obj& obj);
int cls_obj_set_bucket_tag_timeout(rgw_bucket& bucket, uint64_t timeout);
int cls_bucket_list(rgw_bucket& bucket, string start, string prefix, uint32_t num,
map<string, RGWObjEnt>& m, bool *is_truncated,
int cls_bucket_head_async(rgw_bucket& bucket, RGWGetDirHeader_CB *ctx);
int prepare_update_index(RGWObjState *state, rgw_bucket& bucket,
RGWModifyOp op, rgw_obj& oid, string& tag);
- int complete_update_index(rgw_bucket& bucket, string& oid, string& tag, int64_t poolid, uint64_t epoch, uint64_t size,
+ int complete_update_index(rgw_bucket& bucket, rgw_obj& obj, string& tag, int64_t poolid, uint64_t epoch, uint64_t size,
utime_t& ut, string& etag, string& content_type, bufferlist *acl_bl, RGWObjCategory category,
list<string> *remove_objs);
- int complete_update_index_del(rgw_bucket& bucket, string& oid, string& tag, int64_t pool, uint64_t epoch) {
+ int complete_update_index_del(rgw_bucket& bucket, rgw_obj& obj, string& tag, int64_t pool, uint64_t epoch) {
if (bucket_is_system(bucket))
return 0;
- return cls_obj_complete_del(bucket, tag, pool, epoch, oid);
+ return cls_obj_complete_del(bucket, tag, pool, epoch, obj);
}
- int complete_update_index_cancel(rgw_bucket& bucket, string& oid, string& tag) {
+ int complete_update_index_cancel(rgw_bucket& bucket, rgw_obj& obj, string& tag) {
if (bucket_is_system(bucket))
return 0;
- return cls_obj_complete_cancel(bucket, tag, oid);
+ return cls_obj_complete_cancel(bucket, tag, obj);
}
int list_bi_log_entries(rgw_bucket& bucket, string& marker, uint32_t max, std::list<rgw_bi_log_entry>& result, bool *truncated);
int trim_bi_log_entries(rgw_bucket& bucket, string& marker, string& end_marker);
int RGWRESTStreamWriteRequest::put_obj_init(RGWAccessKey& key, rgw_obj& obj, uint64_t obj_size, map<string, bufferlist>& attrs)
{
- string resource = obj.bucket.name + "/" + obj.object;
+ string resource = obj.bucket.name + "/" + obj.get_object();
string new_url = url;
if (new_url[new_url.size() - 1] != '/')
new_url.append("/");
{
string urlsafe_bucket, urlsafe_object;
url_encode(obj.bucket.name, urlsafe_bucket);
- url_encode(obj.object, urlsafe_object);
+ url_encode(obj.get_object(), urlsafe_object);
string resource = urlsafe_bucket + "/" + urlsafe_object;
string new_url = url;
if (new_url[new_url.size() - 1] != '/')