/* The bucket here can either be the bucket name identifier, or the ID
* in period format: ".123" */
- virtual int get_bucket_info(string& bucket, RGWBucketInfo& info) = 0;
+ virtual int get_bucket_info(void *ctx, string& bucket, RGWBucketInfo& info) = 0;
virtual int remove_temp_objects(string date, string time) {
policy.create_default(user_id, display_name);
policy.encode(aclbl);
- ret = rgwstore->get_bucket_info(bucket_str, bucket_info);
+ ret = rgwstore->get_bucket_info(NULL, bucket_str, bucket_info);
if (ret < 0)
return ret;
int bucket_stats(rgw_bucket& bucket, Formatter *formatter)
{
RGWBucketInfo bucket_info;
- int r = rgwstore->get_bucket_info(bucket.name, bucket_info);
+ int r = rgwstore->get_bucket_info(NULL, bucket.name, bucket_info);
if (r < 0)
return r;
snprintf(bucket_char, sizeof(bucket_char), ".%lld",
(long long unsigned)bucket_id);
string bucket_string(bucket_char);
- int ret = rgwstore->get_bucket_info(bucket_string, bucket_info);
+ int ret = rgwstore->get_bucket_info(NULL, bucket_string, bucket_info);
if (ret < 0) {
cerr << "could not retrieve bucket info for bucket_id=" << bucket_id << std::endl;
} else {
string bucket_name_str = bucket_name;
RGWBucketInfo bucket_info;
- int r = rgwstore->get_bucket_info(bucket_name_str, bucket_info);
+ int r = rgwstore->get_bucket_info(NULL, bucket_name_str, bucket_info);
if (r < 0) {
cerr << "could not get bucket info for bucket=" << bucket_name_str << std::endl;
return r;
return r;
}
-int RGWFS::get_bucket_info(string& bucket_name, RGWBucketInfo& info)
+int RGWFS::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& info)
{
return -ENOTSUP;
}
int read(void *ctx, rgw_obj& obj, off_t ofs, size_t size, bufferlist& bl);
int obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime);
- virtual int get_bucket_info(string& bucket_name, RGWBucketInfo& info);
+ virtual int get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& info);
};
#endif
abort_early(s, init_error);
goto done;
}
-
ret = handler->authorize();
if (ret < 0) {
dout(10) << "failed to authorize request" << dendl;
{
int ret = 0;
string obj_str;
-
if (!s->acl) {
s->acl = new RGWAccessControlPolicy;
if (!s->acl)
if (s->bucket_name_str.size()) {
RGWBucketInfo bucket_info;
- ret = rgwstore->get_bucket_info(s->bucket_name_str, bucket_info);
+ ret = rgwstore->get_bucket_info(s->obj_ctx, s->bucket_name_str, bucket_info);
if (ret < 0) {
dout(0) << "couldn't get bucket from bucket_name (name=" << s->bucket_name_str << ")" << dendl;
return ret;
RGWBucketInfo bucket_info;
- ret = rgwstore->get_bucket_info(src_bucket_name, bucket_info);
+ ret = rgwstore->get_bucket_info(s->obj_ctx, src_bucket_name, bucket_info);
if (ret < 0)
return ret;
int RGWRados::get_obj_state(RGWRadosCtx *rctx, rgw_obj& obj, librados::IoCtx& io_ctx, string& actual_obj, RGWObjState **state)
{
+ dout(20) << "get_obj_state: rctx=" << (void *)rctx << " obj=" << obj << dendl;
RGWObjState *s = rctx->get_state(obj);
*state = s;
if (s->has_attrs)
return 0;
}
-int RGWRados::get_bucket_info(string& bucket_name, RGWBucketInfo& info)
+int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& info)
{
bufferlist bl;
- int ret = rgw_get_obj(pi_buckets_rados, bucket_name, bl);
+ int ret = rgw_get_obj(ctx, pi_buckets_rados, bucket_name, bl);
if (ret < 0) {
if (ret != -ENOENT)
return ret;
int (*intent_cb)(void *user_ctx, rgw_obj& obj, RGWIntentEvent intent);
void *user_ctx;
RGWObjState *get_state(rgw_obj& obj) {
- return &objs_state[obj];
+ if (obj.object.size()) {
+ return &objs_state[obj];
+ } else {
+ rgw_obj new_obj(rgw_root_bucket, obj.bucket.name);
+ return &objs_state[new_obj];
+ }
}
void set_atomic(rgw_obj& obj) {
- objs_state[obj].is_atomic = true;
+ if (obj.object.size()) {
+ objs_state[obj].is_atomic = true;
+ } else {
+ rgw_obj new_obj(rgw_root_bucket, obj.bucket.name);
+ objs_state[new_obj].is_atomic = true;
+ }
}
void set_intent_cb(int (*cb)(void *user_ctx, rgw_obj& obj, RGWIntentEvent intent)) {
intent_cb = cb;
int decode_policy(bufferlist& bl, ACLOwner *owner);
int get_bucket_stats(rgw_bucket& bucket, map<RGWObjCategory, RGWBucketStats>& stats);
- virtual int get_bucket_info(string& bucket_name, RGWBucketInfo& info);
+ virtual int get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& info);
int cls_rgw_init_index(rgw_bucket& bucket, string& oid);
int cls_obj_prepare_op(rgw_bucket& bucket, uint8_t op, string& tag, string& name);
return ret;
}
-int rgw_get_obj(rgw_bucket& bucket, string& key, bufferlist& bl)
+int rgw_get_obj(void *ctx, rgw_bucket& bucket, string& key, bufferlist& bl)
{
int ret;
char *data = NULL;
bufferlist::iterator iter;
int request_len = READ_CHUNK_LEN;
rgw_obj obj(bucket, key);
- ret = rgwstore->prepare_get_obj(NULL, obj, 0, NULL, NULL, NULL,
+ ret = rgwstore->prepare_get_obj(ctx, obj, 0, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, &handle, &err);
if (ret < 0)
return ret;
do {
- ret = rgwstore->get_obj(NULL, &handle, obj, &data, 0, request_len - 1);
+ ret = rgwstore->get_obj(ctx, &handle, obj, &data, 0, request_len - 1);
if (ret < 0)
goto done;
if (ret < request_len)
int rgw_put_obj(string& uid, rgw_bucket& bucket, string& oid, const char *data, size_t size);
-int rgw_get_obj(rgw_bucket& bucket, string& key, bufferlist& bl);
+int rgw_get_obj(void *ctx, rgw_bucket& bucket, string& key, bufferlist& bl);
#endif
bufferlist bl;
RGWUID uid;
- int ret = rgw_get_obj(bucket, key, bl);
+ int ret = rgw_get_obj(NULL, bucket, key, bl);
if (ret < 0)
return ret;