time(&info.creation_time);
else
info.creation_time = creation_time;
- ret = put_bucket_info(bucket.name, info, exclusive, 0, &attrs, true);
+ ret = put_bucket_info(info, exclusive, 0, &attrs, true);
if (ret == -EEXIST) {
/* remove bucket meta instance */
string entry;
{
RGWBucketInfo info;
map<string, bufferlist> attrs;
- int r = get_bucket_info(NULL, bucket.name, info, NULL, &attrs);
+ int r = get_bucket_instance_info(NULL, bucket, info, NULL, &attrs);
if (r < 0) {
ldout(cct, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << dendl;
return r;
info.owner = owner.get_id();
- r = put_bucket_info(bucket.name, info, false, 0, &attrs, false);
+ r = put_bucket_instance_info(info, false, 0, &attrs);
if (r < 0) {
ldout(cct, 0) << "NOTICE: put_bucket_info on bucket=" << bucket.name << " returned err=" << r << dendl;
return r;
RGWBucketInfo info;
map<string, bufferlist> attrs;
- int r = get_bucket_info(NULL, bucket.name, info, NULL, &attrs);
+ int r = get_bucket_instance_info(NULL, bucket, info, NULL, &attrs);
if (r < 0) {
ldout(cct, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << ", skipping bucket" << dendl;
ret = r;
info.flags |= BUCKET_SUSPENDED;
}
- r = put_bucket_info(bucket.name, info, false, 0, &attrs, false);
+ r = put_bucket_instance_info(info, false, 0, &attrs);
if (r < 0) {
ldout(cct, 0) << "NOTICE: put_bucket_info on bucket=" << bucket.name << " returned err=" << r << ", skipping bucket" << dendl;
ret = r;
oid = RGW_BUCKET_INSTANCE_MD_PREFIX + entry;
}
-int RGWRados::get_bucket_instance_info(void *ctx, string& entry, RGWBucketInfo& info,
+int RGWRados::get_bucket_instance_info(void *ctx, const string& meta_key, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs)
{
- int pos = entry.find(':');
+ int pos = meta_key.find(':');
if (pos < 0) {
return -EINVAL;
}
- string oid = RGW_BUCKET_INSTANCE_MD_PREFIX + entry;
+ string oid = RGW_BUCKET_INSTANCE_MD_PREFIX + meta_key;
+
+ return get_bucket_instance_from_oid(ctx, oid, info, pmtime, pattrs);
+}
+
+int RGWRados::get_bucket_instance_info(void *ctx, rgw_bucket& bucket, RGWBucketInfo& info,
+ time_t *pmtime, map<string, bufferlist> *pattrs)
+{
+ string oid;
+ get_bucket_meta_oid(bucket, oid);
return get_bucket_instance_from_oid(ctx, oid, info, pmtime, pattrs);
}
return rgw_bucket_store_info(this, bucket_name, epbl, exclusive, NULL, &objv_tracker, mtime);
}
-int RGWRados::put_bucket_instance_info(string& bucket_name, RGWBucketInfo& info, bool exclusive,
+int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive,
time_t mtime, map<string, bufferlist> *pattrs)
{
info.has_instance_obj = true;
return rgw_bucket_instance_store_info(this, key, bl, exclusive, pattrs, &info.objv_tracker, mtime);
}
-int RGWRados::put_bucket_info(string& bucket_name, RGWBucketInfo& info, bool exclusive,
- time_t mtime, map<string, bufferlist> *pattrs, bool create_entry_point)
+int RGWRados::put_bucket_info(RGWBucketInfo& info, bool exclusive, time_t mtime,
+ map<string, bufferlist> *pattrs, bool create_entry_point)
{
bufferlist bl;
bool create_head = !info.has_instance_obj || create_entry_point;
- int ret = put_bucket_instance_info(bucket_name, info, exclusive, mtime, pattrs);
+ int ret = put_bucket_instance_info(info, exclusive, mtime, pattrs);
if (ret < 0) {
return ret;
}
void get_bucket_meta_oid(rgw_bucket& bucket, string& oid);
int put_bucket_entrypoint_info(string& bucket_name, RGWBucketEntryPoint& entry_point, bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime);
- int put_bucket_instance_info(string& bucket_name, RGWBucketInfo& info, bool exclusive, 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(void *ctx, string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime);
- int get_bucket_instance_info(void *ctx, string& name, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
+ int get_bucket_instance_info(void *ctx, const string& meta_key, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
+ int get_bucket_instance_info(void *ctx, rgw_bucket& bucket, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
int get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs);
virtual int get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& info,
time_t *pmtime, map<string, bufferlist> *pattrs = NULL);
- virtual int put_bucket_info(string& bucket_name, RGWBucketInfo& info, bool exclusive,
- time_t mtime, map<string, bufferlist> *pattrs, bool create_entry_point);
+ virtual int put_bucket_info(RGWBucketInfo& info, bool exclusive, time_t mtime,
+ map<string, bufferlist> *pattrs, bool create_entry_point);
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,