virtual int initialize(CephContext *cct) = 0;
virtual void finalize() {}
/** prepare a listing of all buckets. */
- virtual int list_buckets_init(std::string& id, RGWAccessHandle *handle) = 0;
+ virtual int list_buckets_init(RGWAccessHandle *handle) = 0;
/** get the next bucket in the provided listing context. */
- virtual int list_buckets_next(std::string& id, RGWObjEnt& obj, RGWAccessHandle *handle) = 0;
+ virtual int list_buckets_next(RGWObjEnt& obj, RGWAccessHandle *handle) = 0;
virtual int log_list_init(const string& prefix, RGWAccessHandle *handle) { return -ENOENT; }
virtual int log_list_next(RGWAccessHandle handle, string *name) { return -ENOENT; }
/**
* get listing of the objects in a bucket.
- * id: ignored in current implementations
* bucket: bucket to list contents of
* max: maximum number of results to return
* prefix: only return results that match this prefix
* common_prefixes: if delim is filled in, any matching prefixes are placed
* here.
*/
- virtual int list_objects(std::string& id, rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
+ virtual int list_objects(rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
bool get_content_type, std::string& ns, bool *is_truncated, RGWAccessListFilter *filter) = 0;
/** Create a new bucket*/
- virtual int create_bucket(std::string& id, rgw_bucket& bucket,
+ virtual int create_bucket(string& owner, rgw_bucket& bucket,
map<std::string, bufferlist>& attrs,
bool system_bucket, bool exclusive = true,
uint64_t auid = 0) = 0;
virtual int add_bucket_placement(std::string& new_placement) { return 0; }
- virtual int create_pools(std::string& id, vector<string>& names, vector<int>& retcodes, int auid = 0) { return -ENOTSUP; }
+ virtual int create_pools(vector<string>& names, vector<int>& retcodes, int auid = 0) { return -ENOTSUP; }
/** write an object to the storage device in the appropriate pool
with the given stats */
- virtual int put_obj_meta(void *ctx, std::string& id, rgw_obj& obj, uint64_t size, time_t *mtime,
+ virtual int put_obj_meta(void *ctx, rgw_obj& obj, uint64_t size, time_t *mtime,
map<std::string, bufferlist>& attrs, RGWObjCategory category, bool exclusive,
map<std::string, bufferlist>* rmattrs) = 0;
- virtual int put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+ virtual int put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t len) = 0;
- virtual int aio_put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+ virtual int aio_put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t len, void **handle) { return -ENOTSUP; }
/* note that put_obj doesn't set category on an object, only use it for none user objects */
- int put_obj(void *ctx, std::string& id, rgw_obj& obj, const char *data, size_t len,
+ int put_obj(void *ctx, rgw_obj& obj, const char *data, size_t len,
time_t *mtime, map<std::string, bufferlist>& attrs) {
- int ret = put_obj_data(ctx, id, obj, data, -1, len);
+ int ret = put_obj_data(ctx, obj, data, -1, len);
if (ret >= 0) {
- ret = put_obj_meta(ctx, id, obj, len, mtime, attrs, RGW_OBJ_CATEGORY_NONE, false, NULL);
+ ret = put_obj_meta(ctx, obj, len, mtime, attrs, RGW_OBJ_CATEGORY_NONE, false, NULL);
}
return ret;
}
/**
* Copy an object.
- * id: unused (well, it's passed to put_obj)
* dest_bucket: the bucket to copy into
* dest_obj: the object to copy into
* src_bucket: the bucket to copy from
* err: stores any errors resulting from the get of the original object
* Returns: 0 on success, -ERR# otherwise.
*/
- virtual int copy_obj(void *ctx, std::string& id, rgw_obj& dest_obj,
+ virtual int copy_obj(void *ctx, rgw_obj& dest_obj,
rgw_obj& src_obj,
time_t *mtime,
const time_t *mod_ptr,
struct rgw_err *err) = 0;
/**
* Delete a bucket.
- * id: unused in implementations
* bucket: the name of the bucket to delete
* Returns 0 on success, -ERR# otherwise.
*/
- virtual int delete_bucket(std::string& id, rgw_bucket& bucket, bool remove_pool) = 0;
- virtual int purge_buckets(std::string& id, vector<rgw_bucket>& buckets) { return -ENOTSUP; }
+ virtual int delete_bucket(rgw_bucket& bucket, bool remove_pool) = 0;
+ virtual int purge_buckets(vector<rgw_bucket>& buckets) { return -ENOTSUP; }
virtual int set_buckets_enabled(std::vector<rgw_bucket>& buckets, bool enabled) { return -ENOTSUP; }
virtual int bucket_suspended(rgw_bucket& bucket, bool *suspended) {
/**
* Delete an object.
- * id: unused in current implementations
* bucket: name of the bucket storing the object
* obj: name of the object to delete
* Returns: 0 on success, -ERR# otherwise.
*/
- virtual int delete_obj(void *ctx, std::string& id, rgw_obj& obj, bool sync = true) = 0;
+ virtual int delete_obj(void *ctx, rgw_obj& obj, bool sync = true) = 0;
/**
* Get data about an object out of RADOS and into memory.
if (!old_info.user_email.empty() &&
old_info.user_email.compare(new_info.user_email) != 0) {
- ret = rgw_remove_email_index(new_info.user_id, old_info.user_email);
+ ret = rgw_remove_email_index(old_info.user_email);
if (ret < 0 && ret != -ENOENT) {
cerr << "ERROR: could not remove index for email " << old_info.user_email << " return code: " << ret << std::endl;
success = false;
RGWAccessKey& swift_key = old_iter->second;
map<string, RGWAccessKey>::iterator new_iter = new_info.swift_keys.find(swift_key.id);
if (new_iter == new_info.swift_keys.end()) {
- ret = rgw_remove_swift_name_index(new_info.user_id, swift_key.id);
+ ret = rgw_remove_swift_name_index(swift_key.id);
if (ret < 0 && ret != -ENOENT) {
cerr << "ERROR: could not remove index for swift_name " << swift_key.id << " return code: " << ret << std::endl;
success = false;
}
if (opt_cmd == OPT_BUCKETS_LIST) {
- string id;
RGWAccessHandle handle;
formatter->reset();
}
}
} else {
- if (store->list_buckets_init(id, &handle) < 0) {
+ if (store->list_buckets_init(&handle) < 0) {
cerr << "list buckets: no buckets found" << std::endl;
} else {
RGWObjEnt obj;
- while (store->list_buckets_next(id, obj, &handle) >= 0) {
+ while (store->list_buckets_next(obj, &handle) >= 0) {
formatter->dump_string("bucket", obj.name);
}
}
RGWCache() {}
int set_attr(void *ctx, rgw_obj& obj, const char *name, bufferlist& bl);
- int put_obj_meta(void *ctx, std::string& id, rgw_obj& obj, uint64_t size, time_t *mtime,
+ int put_obj_meta(void *ctx, rgw_obj& obj, uint64_t size, time_t *mtime,
map<std::string, bufferlist>& attrs, RGWObjCategory category, bool exclusive,
map<std::string, bufferlist>* rmattrs);
- int put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+ int put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t len);
int get_obj(void *ctx, void **handle, rgw_obj& obj, char **data, off_t ofs, off_t end);
int obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, map<string, bufferlist> *attrs);
- int delete_obj(void *ctx, std::string& id, rgw_obj& obj, bool sync);
+ int delete_obj(void *ctx, rgw_obj& obj, bool sync);
};
template <class T>
-int RGWCache<T>::delete_obj(void *ctx, std::string& id, rgw_obj& obj, bool sync)
+int RGWCache<T>::delete_obj(void *ctx, rgw_obj& obj, bool sync)
{
rgw_bucket bucket;
string oid;
normalize_bucket_and_obj(obj.bucket, obj.object, bucket, oid);
if (bucket.name[0] != '.')
- return T::delete_obj(ctx, id, obj, sync);
+ return T::delete_obj(ctx, obj, sync);
string name = normal_name(obj);
cache.remove(name);
ObjectCacheInfo info;
distribute(obj, info, REMOVE_OBJ);
- return T::delete_obj(ctx, id, obj, sync);
+ return T::delete_obj(ctx, obj, sync);
}
template <class T>
}
template <class T>
-int RGWCache<T>::put_obj_meta(void *ctx, std::string& id, rgw_obj& obj, uint64_t size, time_t *mtime,
+int RGWCache<T>::put_obj_meta(void *ctx, rgw_obj& obj, uint64_t size, time_t *mtime,
map<std::string, bufferlist>& attrs, RGWObjCategory category, bool exclusive,
map<std::string, bufferlist>* rmattrs)
{
info.status = 0;
info.flags = CACHE_FLAG_XATTRS;
}
- int ret = T::put_obj_meta(ctx, id, obj, size, mtime, attrs, category, exclusive, rmattrs);
+ int ret = T::put_obj_meta(ctx, obj, size, mtime, attrs, category, exclusive, rmattrs);
if (cacheable) {
string name = normal_name(bucket, oid);
if (ret >= 0) {
}
template <class T>
-int RGWCache<T>::put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+int RGWCache<T>::put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t len)
{
rgw_bucket bucket;
info.status = 0;
info.flags = CACHE_FLAG_DATA;
}
- int ret = T::put_obj_data(ctx, id, obj, data, ofs, len);
+ int ret = T::put_obj_data(ctx, obj, data, ofs, len);
if (cacheable) {
string name = normal_name(bucket, oid);
if (ret >= 0) {
return 0;
}
-int RGWFS::list_buckets_init(string& id, RGWAccessHandle *handle)
+int RGWFS::list_buckets_init(RGWAccessHandle *handle)
{
DIR *dir = opendir(DIR_NAME);
struct rgwfs_state *state;
return 0;
}
-int RGWFS::list_buckets_next(string& id, RGWObjEnt& obj, RGWAccessHandle *handle)
+int RGWFS::list_buckets_next(RGWObjEnt& obj, RGWAccessHandle *handle)
{
struct rgwfs_state *state;
struct dirent *dirent;
return -ENOTSUP;
}
-int RGWFS::list_objects(string& id, rgw_bucket& bucket, int max, string& prefix, string& delim,
+int RGWFS::list_objects(rgw_bucket& bucket, int max, string& prefix, string& delim,
string& marker, vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
bool get_content_type, string& ns, bool *is_truncated, RGWAccessListFilter *filter)
{
}
-int RGWFS::create_bucket(std::string& id, rgw_bucket& bucket, map<std::string, bufferlist>& attrs, bool system_bucket, bool exclusive, uint64_t auid)
+int RGWFS::create_bucket(std::string& owner, rgw_bucket& bucket, map<std::string, bufferlist>& attrs, bool system_bucket, bool exclusive, uint64_t auid)
{
int len = strlen(DIR_NAME) + 1 + bucket.name.size() + 1;
char buf[len];
return 0;
}
-int RGWFS::put_obj_meta(void *ctx, std::string& id, rgw_obj& obj,
+int RGWFS::put_obj_meta(void *ctx, rgw_obj& obj,
uint64_t size, time_t *mtime, map<string, bufferlist>& attrs,
RGWObjCategory category, bool exclusive,
map<std::string, bufferlist> *rmattrs)
return -errno;
}
-int RGWFS::put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+int RGWFS::put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t size)
{
rgw_bucket& bucket = obj.bucket;
return r;
}
-int RGWFS::copy_obj(void *ctx, std::string& id, rgw_obj& dest_obj,
+int RGWFS::copy_obj(void *ctx, rgw_obj& dest_obj,
rgw_obj& src_obj,
time_t *mtime,
const time_t *mod_ptr,
}
attrs = attrset;
- ret = put_obj(ctx, id, dest_obj, data, ret, mtime, attrs);
+ ret = put_obj(ctx, dest_obj, data, ret, mtime, attrs);
return ret;
}
-int RGWFS::delete_bucket(std::string& id, rgw_bucket& bucket, bool remove_pool)
+int RGWFS::delete_bucket(rgw_bucket& bucket, bool remove_pool)
{
int len = strlen(DIR_NAME) + 1 + bucket.name.size() + 1;
char buf[len];
}
-int RGWFS::delete_obj(void *ctx, std::string& id, rgw_obj& obj, bool sync)
+int RGWFS::delete_obj(void *ctx, rgw_obj& obj, bool sync)
{
rgw_bucket& bucket = obj.bucket;
std::string& oid = obj.object;
};
public:
virtual int initialize(CephContext *cct);
- int list_buckets_init(std::string& id, RGWAccessHandle *handle);
- int list_buckets_next(std::string& id, RGWObjEnt& obj, RGWAccessHandle *handle);
+ int list_buckets_init(RGWAccessHandle *handle);
+ int list_buckets_next(RGWObjEnt& obj, RGWAccessHandle *handle);
- int list_objects(std::string& id, rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
+ int list_objects(rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
bool get_content_type, string& ns, bool *is_truncated, RGWAccessListFilter *filter);
- int create_bucket(std::string& id, rgw_bucket& bucket, map<std::string, bufferlist>& attrs, bool system_bucket, bool exclusive, uint64_t auid=0);
- int put_obj_meta(void *ctx, std::string& id, rgw_obj& obj, uint64_t size, time_t *mtime,
+ int create_bucket(std::string& owner, rgw_bucket& bucket, map<std::string, bufferlist>& attrs, bool system_bucket, bool exclusive, uint64_t auid=0);
+ int put_obj_meta(void *ctx, rgw_obj& obj, uint64_t size, time_t *mtime,
map<std::string, bufferlist>& attrs, RGWObjCategory category, bool exclusive,
map<std::string, bufferlist> *rmattrs);
- int put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+ int put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t size);
- int copy_obj(void *ctx, std::string& id, rgw_obj& dest_obj,
+ int copy_obj(void *ctx, rgw_obj& dest_obj,
rgw_obj& src_obj,
time_t *mtime,
const time_t *mod_ptr,
map<std::string, bufferlist>& attrs,
RGWObjCategory category,
struct rgw_err *err);
- int delete_bucket(std::string& id, rgw_bucket& bucket, bool remove_pool);
- int delete_obj(void *ctx, std::string& id, rgw_obj& obj, bool sync);
+ int delete_bucket(rgw_bucket& bucket, bool remove_pool);
+ int delete_obj(void *ctx, rgw_obj& obj, bool sync);
int get_attr(const char *name, int fd, char **attr);
int get_attr(const char *name, const char *path, char **attr);
if (ret < 0)
goto done;
- ret = rgwstore->list_objects(s->user.user_id, s->bucket, max, prefix, delimiter, marker, objs, common_prefixes,
+ ret = rgwstore->list_objects(s->bucket, max, prefix, delimiter, marker, objs, common_prefixes,
!!(s->prot_flags & RGW_REST_SWIFT), no_ns, &is_truncated, NULL);
done:
ret = -EINVAL;
if (s->bucket_name) {
- ret = rgwstore->delete_bucket(s->user.user_id, s->bucket, false);
+ ret = rgwstore->delete_bucket(s->bucket, false);
if (ret == 0) {
ret = rgw_remove_user_bucket_info(s->user.user_id, s->bucket, false);
// For the first call to put_obj_data, pass -1 as the offset to
// do a write_full.
void *handle;
- ret = rgwstore->aio_put_obj_data(s->obj_ctx, s->user.user_id, obj,
+ ret = rgwstore->aio_put_obj_data(s->obj_ctx, obj,
data,
((ofs == 0) ? -1 : ofs), len, &handle);
if (ret < 0)
if (ret < 0)
goto done_err;
if (created_obj) {
- ret = rgwstore->delete_obj(NULL, s->user.user_id, obj, false);
+ ret = rgwstore->delete_obj(NULL, obj, false);
if (ret < 0)
goto done;
}
} else {
- ret = rgwstore->put_obj_meta(s->obj_ctx, s->user.user_id, obj, s->obj_size, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, false, NULL);
+ ret = rgwstore->put_obj_meta(s->obj_ctx, obj, s->obj_size, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, false, NULL);
if (ret < 0)
goto done_err;
done_err:
if (created_obj)
- rgwstore->delete_obj(s->obj_ctx, s->user.user_id, obj);
+ rgwstore->delete_obj(s->obj_ctx, obj);
drain_pending(pending);
send_response();
}
}
}
- ret = rgwstore->put_obj_meta(s->obj_ctx, s->user.user_id, obj, s->obj_size, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, false, &rmattrs);
+ ret = rgwstore->put_obj_meta(s->obj_ctx, obj, s->obj_size, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, false, &rmattrs);
done:
send_response();
rgw_obj obj(s->bucket, s->object_str);
if (s->object) {
rgwstore->set_atomic(s->obj_ctx, obj);
- ret = rgwstore->delete_obj(s->obj_ctx, s->user.user_id, obj);
+ ret = rgwstore->delete_obj(s->obj_ctx, obj);
}
send_response();
rgwstore->set_atomic(s->obj_ctx, src_obj);
rgwstore->set_atomic(s->obj_ctx, dst_obj);
- ret = rgwstore->copy_obj(s->obj_ctx, s->user.user_id,
+ ret = rgwstore->copy_obj(s->obj_ctx,
dst_obj,
src_obj,
&mtime,
ACLGranteeType& type = src_grant->get_type();
ACLGrant new_grant;
bool grant_ok = false;
- string id;
+ string uid;
RGWUserInfo grant_user;
switch (type.get_type()) {
case ACL_TYPE_EMAIL_USER:
dout(10) << "grant user email not found or other error" << dendl;
return -ERR_UNRESOLVABLE_EMAIL;
}
- id = grant_user.user_id;
+ uid = grant_user.user_id;
}
case ACL_TYPE_CANON_USER:
{
if (type.get_type() == ACL_TYPE_CANON_USER)
- id = src_grant->get_id();
+ uid = src_grant->get_id();
- if (grant_user.user_id.empty() && rgw_get_user_info_by_uid(id, grant_user) < 0) {
- dout(10) << "grant user does not exist:" << id << dendl;
+ if (grant_user.user_id.empty() && rgw_get_user_info_by_uid(uid, grant_user) < 0) {
+ dout(10) << "grant user does not exist:" << uid << dendl;
return -EINVAL;
} else {
ACLPermission& perm = src_grant->get_permission();
- new_grant.set_canon(id, grant_user.display_name, perm.get_permissions());
+ new_grant.set_canon(uid, grant_user.display_name, perm.get_permissions());
grant_ok = true;
dout(10) << "new grant: " << new_grant.get_id() << ":" << grant_user.display_name << dendl;
}
obj.init(s->bucket, tmp_obj_name, s->object_str, mp_ns);
// the meta object will be indexed with 0 size, we c
- ret = rgwstore->put_obj_meta(s->obj_ctx, s->user.user_id, obj, 0, NULL, attrs, RGW_OBJ_CATEGORY_MULTIMETA, true, NULL);
+ ret = rgwstore->put_obj_meta(s->obj_ctx, obj, 0, NULL, attrs, RGW_OBJ_CATEGORY_MULTIMETA, true, NULL);
} while (ret == -EEXIST);
done:
send_response();
target_obj.init(s->bucket, s->object_str);
rgwstore->set_atomic(s->obj_ctx, target_obj);
- ret = rgwstore->put_obj_meta(s->obj_ctx, s->user.user_id, target_obj, 0, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, false, NULL);
+ ret = rgwstore->put_obj_meta(s->obj_ctx, target_obj, 0, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, false, NULL);
if (ret < 0)
goto done;
for (obj_iter = obj_parts.begin(); obj_iter != obj_parts.end(); ++obj_iter) {
string oid = mp.get_part(obj_iter->second.num);
rgw_obj obj(s->bucket, oid, s->object_str, mp_ns);
- rgwstore->delete_obj(s->obj_ctx, s->user.user_id, obj);
+ rgwstore->delete_obj(s->obj_ctx, obj);
}
// and also remove the metadata obj
meta_obj.init(s->bucket, meta_oid, s->object_str, mp_ns);
- rgwstore->delete_obj(s->obj_ctx, s->user.user_id, meta_obj);
+ rgwstore->delete_obj(s->obj_ctx, meta_obj);
done:
send_response();
for (obj_iter = obj_parts.begin(); obj_iter != obj_parts.end(); ++obj_iter) {
string oid = mp.get_part(obj_iter->second.num);
rgw_obj obj(s->bucket, oid, s->object_str, mp_ns);
- ret = rgwstore->delete_obj(s->obj_ctx, s->user.user_id, obj);
+ ret = rgwstore->delete_obj(s->obj_ctx, obj);
if (ret < 0 && ret != -ENOENT)
goto done;
}
// and also remove the metadata obj
meta_obj.init(s->bucket, meta_oid, s->object_str, mp_ns);
- ret = rgwstore->delete_obj(s->obj_ctx, s->user.user_id, meta_obj);
+ ret = rgwstore->delete_obj(s->obj_ctx, meta_obj);
if (ret == -ENOENT) {
ret = -ERR_NO_SUCH_BUCKET;
}
}
}
marker_meta = marker.get_meta();
- ret = rgwstore->list_objects(s->user.user_id, s->bucket, max_uploads, prefix, delimiter, marker_meta, objs, common_prefixes,
+ ret = rgwstore->list_objects(s->bucket, max_uploads, prefix, delimiter, marker_meta, objs, common_prefixes,
!!(s->prot_flags & RGW_REST_SWIFT), mp_ns, &is_truncated, &mp_filter);
if (objs.size()) {
vector<RGWObjEnt>::iterator iter;
/**
* set up a bucket listing.
- * id is ignored
* handle is filled in.
* Returns 0 on success, -ERR# otherwise.
*/
-int RGWRados::list_buckets_init(std::string& id, RGWAccessHandle *handle)
+int RGWRados::list_buckets_init(RGWAccessHandle *handle)
{
librados::ObjectIterator *state = new librados::ObjectIterator(root_pool_ctx.objects_begin());
*handle = (RGWAccessHandle)state;
/**
* get the next bucket in the listing.
- * id is ignored
* obj is filled in,
* handle is updated.
* returns 0 on success, -ERR# otherwise.
*/
-int RGWRados::list_buckets_next(std::string& id, RGWObjEnt& obj, RGWAccessHandle *handle)
+int RGWRados::list_buckets_next(RGWObjEnt& obj, RGWAccessHandle *handle)
{
librados::ObjectIterator *state = (librados::ObjectIterator *)*handle;
/**
* get listing of the objects in a bucket.
- * id: ignored.
* bucket: bucket to list contents of
* max: maximum number of results to return
* prefix: only return results that match this prefix
* common_prefixes: if delim is filled in, any matching prefixes are placed
* here.
*/
-int RGWRados::list_objects(string& id, rgw_bucket& bucket, int max, string& prefix, string& delim,
+int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string& delim,
string& marker, vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
bool get_content_type, string& ns, bool *is_truncated, RGWAccessListFilter *filter)
{
/**
* create a bucket with name bucket and the given list of attrs
- * if auid is set, it sets the auid of the underlying rados io_ctx
* returns 0 on success, -ERR# otherwise.
*/
-int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket,
+int RGWRados::create_bucket(string& owner, rgw_bucket& bucket,
map<std::string, bufferlist>& attrs,
bool system_bucket,
bool exclusive, uint64_t auid)
RGWBucketInfo info;
info.bucket = bucket;
- info.owner = id;
+ info.owner = owner;
ret = store_bucket_info(info);
if (ret < 0) {
dout(0) << "failed to store bucket info, removing bucket" << dendl;
- delete_bucket(id, bucket, true);
+ delete_bucket(bucket, true);
return ret;
}
}
bufferlist bl;
::encode(info, bl);
- string unused;
- int ret = rgw_put_obj(unused, pi_buckets_rados, info.bucket.name, bl.c_str(), bl.length());
+ int ret = rgw_put_obj(info.owner, pi_buckets_rados, info.bucket.name, bl.c_str(), bl.length());
if (ret < 0)
return ret;
char bucket_char[16];
snprintf(bucket_char, sizeof(bucket_char), ".%lld", (long long unsigned)info.bucket.bucket_id);
string bucket_id_string(bucket_char);
- ret = rgw_put_obj(unused, pi_buckets_rados, bucket_id_string, bl.c_str(), bl.length());
+ ret = rgw_put_obj(info.owner, pi_buckets_rados, bucket_id_string, bl.c_str(), bl.length());
dout(0) << "store_bucket_info: bucket=" << info.bucket << " owner " << info.owner << dendl;
return 0;
rgw_obj obj(pi_buckets_rados, avail_pools);
int ret = tmap_get(obj, header, m);
if (ret < 0 || !m.size()) {
- string id;
vector<string> names;
names.push_back(default_storage_pool);
vector<int> retcodes;
bufferlist bl;
- ret = create_pools(id, names, retcodes);
+ ret = create_pools(names, retcodes);
if (ret < 0)
return ret;
ret = tmap_set(obj, default_storage_pool, bl);
return ret;
}
-int RGWRados::create_pools(std::string& id, vector<string>& names, vector<int>& retcodes, int auid)
+int RGWRados::create_pools(vector<string>& names, vector<int>& retcodes, int auid)
{
vector<string>::iterator iter;
vector<librados::PoolAsyncCompletion *> completions;
/**
* Write/overwrite an object to the bucket storage.
- * id: ignored
* bucket: the bucket to store the object in
* obj: the object name/key
* data: the object contents/value
* exclusive: create object exclusively
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::put_obj_meta(void *ctx, std::string& id, rgw_obj& obj, uint64_t size,
+int RGWRados::put_obj_meta(void *ctx, rgw_obj& obj, uint64_t size,
time_t *mtime, map<string, bufferlist>& attrs, RGWObjCategory category, bool exclusive,
map<string, bufferlist>* rmattrs)
{
/**
* Write/overwrite an object to the bucket storage.
- * id: ignored
* bucket: the bucket to store the object in
* obj: the object name/key
* data: the object contents/value
* attrs: all the given attrs are written to bucket storage for the given object
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::put_obj_data(void *ctx, std::string& id, rgw_obj& obj,
+int RGWRados::put_obj_data(void *ctx, rgw_obj& obj,
const char *data, off_t ofs, size_t len)
{
void *handle;
- int r = aio_put_obj_data(ctx, id, obj, data, ofs, len, &handle);
+ int r = aio_put_obj_data(ctx, obj, data, ofs, len, &handle);
if (r < 0)
return r;
return aio_wait(handle);
}
-int RGWRados::aio_put_obj_data(void *ctx, std::string& id, rgw_obj& obj,
+int RGWRados::aio_put_obj_data(void *ctx, rgw_obj& obj,
const char *data, off_t ofs, size_t len,
void **handle)
{
}
/**
* Copy an object.
- * id: unused (well, it's passed to put_obj)
* dest_bucket: the bucket to copy into
* dest_obj: the object to copy into
* src_bucket: the bucket to copy from
* err: stores any errors resulting from the get of the original object
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::copy_obj(void *ctx, std::string& id,
+int RGWRados::copy_obj(void *ctx,
rgw_obj& dest_obj,
rgw_obj& src_obj,
time_t *mtime,
// In the first call to put_obj_data, we pass ofs == -1 so that it will do
// a write_full, wiping out whatever was in the object before this
- r = put_obj_data(ctx, id, tmp_obj, data, ((ofs == 0) ? -1 : ofs), ret);
+ r = put_obj_data(ctx, tmp_obj, data, ((ofs == 0) ? -1 : ofs), ret);
free(data);
if (r < 0)
goto done_err;
if (mtime)
obj_stat(ctx, tmp_obj, NULL, mtime, NULL);
- r = rgwstore->delete_obj(ctx, id, tmp_obj, false);
+ r = rgwstore->delete_obj(ctx, tmp_obj, false);
if (r < 0)
dout(0) << "ERROR: could not remove " << tmp_obj << dendl;
return ret;
done_err:
- rgwstore->delete_obj(ctx, id, tmp_obj, false);
+ rgwstore->delete_obj(ctx, tmp_obj, false);
finish_get_obj(&handle);
return r;
}
/**
* Delete a bucket.
- * id: unused
* bucket: the name of the bucket to delete
* Returns 0 on success, -ERR# otherwise.
*/
-int RGWRados::delete_bucket(std::string& id, rgw_bucket& bucket, bool remove_pool)
+int RGWRados::delete_bucket(rgw_bucket& bucket, bool remove_pool)
{
librados::IoCtx list_ctx;
int r = open_bucket_ctx(bucket, list_ctx);
}
rgw_obj obj(rgw_root_bucket, bucket.name);
- r = delete_obj(NULL, id, obj, true);
+ r = delete_obj(NULL, obj, true);
if (r < 0)
return r;
/**
* Delete buckets, don't care about content
- * id: unused
* bucket: the name of the bucket to delete
* Returns 0 on success, -ERR# otherwise.
*/
-int RGWRados::purge_buckets(std::string& id, vector<rgw_bucket>& buckets)
+int RGWRados::purge_buckets(vector<rgw_bucket>& buckets)
{
librados::IoCtx list_ctx;
vector<rgw_bucket>::iterator iter;
}
rgw_obj obj(rgw_root_bucket, bucket.name);
- r = delete_obj(NULL, id, obj, true);
+ r = delete_obj(NULL, obj, true);
if (r < 0) {
dout(0) << "WARNING: could not remove bucket object: " << RGW_ROOT_BUCKET << ":" << bucket << dendl;
ret = r;
/**
* Delete an object.
- * id: unused
* bucket: name of the bucket storing the object
* obj: name of the object to delete
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::delete_obj_impl(void *ctx, std::string& id, rgw_obj& obj, bool sync)
+int RGWRados::delete_obj_impl(void *ctx, rgw_obj& obj, bool sync)
{
rgw_bucket bucket;
std::string oid, key;
return 0;
}
-int RGWRados::delete_obj(void *ctx, std::string& id, rgw_obj& obj, bool sync)
+int RGWRados::delete_obj(void *ctx, rgw_obj& obj, bool sync)
{
int r;
do {
- r = delete_obj_impl(ctx, id, obj, sync);
+ r = delete_obj_impl(ctx, obj, sync);
} while (r == -ECANCELED);
return r;
}
vector<RGWObjEnt> objs;
map<string, bool> common_prefixes;
string ns;
- string id;
int max = 1000;
bool is_truncated;
IntentLogNameFilter filter(date.c_str(), &tm);
do {
- int r = store->list_objects(id, bucket, max, prefix, delim, marker,
+ int r = store->list_objects(bucket, max, prefix, delim, marker,
objs, common_prefixes, false, ns,
&is_truncated, &filter);
if (r == -ENOENT)
}
bufferlist::iterator iter = bl.begin();
- string id;
bool complete = true;
try {
while (!iter.end()) {
complete = false;
break;
}
- r = rgwstore->delete_obj(NULL, id, entry.obj);
+ r = rgwstore->delete_obj(NULL, entry.obj);
if (r < 0 && r != -ENOENT) {
cerr << "failed to remove obj: " << entry.obj << std::endl;
complete = false;
complete = false;
break;
}
- r = delete_bucket(id, entry.obj.bucket, true);
+ r = delete_bucket(entry.obj.bucket, true);
if (r < 0 && r != -ENOENT) {
cerr << "failed to remove pool: " << entry.obj.bucket.pool << std::endl;
complete = false;
rgw_obj obj(bucket, oid);
cout << "completed intent log: " << obj << (purge ? ", purging it" : "") << std::endl;
if (purge) {
- r = delete_obj(NULL, id, obj, true);
+ r = delete_obj(NULL, obj, true);
if (r < 0)
cerr << "failed to remove obj: " << obj << std::endl;
}
bool truncate_dest,
bool exclusive,
pair<string, bufferlist> *cmp_xattr);
- int delete_obj_impl(void *ctx, std::string& id, rgw_obj& src_obj, bool sync);
+ int delete_obj_impl(void *ctx, rgw_obj& src_obj, bool sync);
int select_bucket_placement(std::string& bucket_name, rgw_bucket& bucket);
int store_bucket_info(RGWBucketInfo& info);
/** Initialize the RADOS instance and prepare to do other ops */
virtual int initialize(CephContext *cct);
- /** set up a bucket listing. id is ignored, handle is filled in. */
- virtual int list_buckets_init(std::string& id, RGWAccessHandle *handle);
+ /** set up a bucket listing. handle is filled in. */
+ virtual int list_buckets_init(RGWAccessHandle *handle);
/**
- * get the next bucket in the listing. id is ignored, obj is filled in,
+ * get the next bucket in the listing. obj is filled in,
* handle is updated.
*/
- virtual int list_buckets_next(std::string& id, RGWObjEnt& obj, RGWAccessHandle *handle);
+ virtual int list_buckets_next(RGWObjEnt& obj, RGWAccessHandle *handle);
/// list logs
int log_list_init(const string& prefix, RGWAccessHandle *handle);
/** get listing of the objects in a bucket */
- virtual int list_objects(std::string& id, rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
+ virtual int list_objects(rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
bool get_content_type, string& ns, bool *is_truncated, RGWAccessListFilter *filter);
* create a bucket with name bucket and the given list of attrs
* returns 0 on success, -ERR# otherwise.
*/
- virtual int create_bucket(std::string& id, rgw_bucket& bucket,
+ virtual int create_bucket(string& owner, rgw_bucket& bucket,
map<std::string,bufferlist>& attrs,
bool system_bucket, bool exclusive = true,
uint64_t auid = 0);
virtual int add_bucket_placement(std::string& new_pool);
- virtual int create_pools(std::string& id, vector<string>& names, vector<int>& retcodes, int auid = 0);
+ virtual int create_pools(vector<string>& names, vector<int>& retcodes, int auid = 0);
/** Write/overwrite an object to the bucket storage. */
- virtual int put_obj_meta(void *ctx, std::string& id, rgw_obj& obj, uint64_t size, time_t *mtime,
+ virtual int put_obj_meta(void *ctx, rgw_obj& obj, uint64_t size, time_t *mtime,
map<std::string, bufferlist>& attrs, RGWObjCategory category, bool exclusive,
map<std::string, bufferlist>* rmattrs);
- virtual int put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+ virtual int put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t len);
- virtual int aio_put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
+ virtual int aio_put_obj_data(void *ctx, rgw_obj& obj, const char *data,
off_t ofs, size_t len, void **handle);
virtual int aio_wait(void *handle);
virtual bool aio_completed(void *handle);
}
/** Copy an object, with many extra options */
- virtual int copy_obj(void *ctx, std::string& id, rgw_obj& dest_obj,
+ virtual int copy_obj(void *ctx, rgw_obj& dest_obj,
rgw_obj& src_obj,
time_t *mtime,
const time_t *mod_ptr,
RGWObjCategory category,
struct rgw_err *err);
/** delete a bucket*/
- virtual int delete_bucket(std::string& id, rgw_bucket& bucket, bool remove_pool);
- virtual int purge_buckets(std::string& id, vector<rgw_bucket>& buckets);
+ virtual int delete_bucket(rgw_bucket& bucket, bool remove_pool);
+ virtual int purge_buckets(vector<rgw_bucket>& buckets);
virtual int set_buckets_enabled(std::vector<rgw_bucket>& buckets, bool enabled);
virtual int bucket_suspended(rgw_bucket& bucket, bool *suspended);
/** Delete an object.*/
- virtual int delete_obj(void *ctx, std::string& id, rgw_obj& src_obj, bool sync);
+ virtual int delete_obj(void *ctx, rgw_obj& src_obj, bool sync);
/** Get the attributes for an object.*/
virtual int get_attr(void *ctx, rgw_obj& obj, const char *name, bufferlist& dest);
rgw_obj obj(bucket, oid);
- int ret = rgwstore->put_obj(NULL, uid, obj, data, size, NULL, attrs);
+ int ret = rgwstore->put_obj(NULL, obj, data, size, NULL, attrs);
if (ret == -ENOENT) {
ret = rgwstore->create_bucket(uid, bucket, attrs, true); //all callers are using system buckets
if (ret >= 0)
- ret = rgwstore->put_obj(NULL, uid, obj, data, size, NULL, attrs);
+ ret = rgwstore->put_obj(NULL, obj, data, size, NULL, attrs);
}
return ret;
if (ret == 0 && purge_data) {
vector<rgw_bucket> buckets_vec;
buckets_vec.push_back(bucket);
- ret = rgwstore->purge_buckets(user_id, buckets_vec);
+ ret = rgwstore->purge_buckets(buckets_vec);
}
int rgw_remove_key_index(RGWAccessKey& access_key)
{
rgw_obj obj(ui_key_bucket, access_key.id);
- int ret = rgwstore->delete_obj(NULL, access_key.id, obj);
+ int ret = rgwstore->delete_obj(NULL, obj);
return ret;
}
int rgw_remove_uid_index(string& uid)
{
rgw_obj obj(ui_uid_bucket, uid);
- int ret = rgwstore->delete_obj(NULL, uid, obj);
+ int ret = rgwstore->delete_obj(NULL, obj);
return ret;
}
-int rgw_remove_email_index(string& uid, string& email)
+int rgw_remove_email_index(string& email)
{
rgw_obj obj(ui_email_bucket, email);
- int ret = rgwstore->delete_obj(NULL, uid, obj);
+ int ret = rgwstore->delete_obj(NULL, obj);
return ret;
}
-int rgw_remove_swift_name_index(string& uid, string& swift_name)
+int rgw_remove_swift_name_index(string& swift_name)
{
rgw_obj obj(ui_swift_bucket, swift_name);
- int ret = rgwstore->delete_obj(NULL, uid, obj);
+ int ret = rgwstore->delete_obj(NULL, obj);
return ret;
}
rgw_obj email_obj(ui_email_bucket, info.user_email);
dout(0) << "removing email index: " << info.user_email << dendl;
- ret = rgwstore->delete_obj(NULL, info.user_id, email_obj);
+ ret = rgwstore->delete_obj(NULL, email_obj);
if (ret < 0 && ret != -ENOENT) {
dout(0) << "ERROR: could not remove " << info.user_id << ":" << email_obj << ", should be fixed (err=" << ret << ")" << dendl;
return ret;
if (purge_data) {
dout(0) << "purging user buckets" << dendl;
- ret = rgwstore->purge_buckets(info.user_id, buckets_vec);
+ ret = rgwstore->purge_buckets(buckets_vec);
if (ret < 0 && ret != -ENOENT) {
dout(0) << "ERROR: delete_buckets returned " << ret << dendl;
return ret;
get_buckets_obj(info.user_id, buckets_obj_id);
rgw_obj uid_bucks(ui_uid_bucket, buckets_obj_id);
dout(0) << "removing user buckets index" << dendl;
- ret = rgwstore->delete_obj(NULL, info.user_id, uid_bucks);
+ ret = rgwstore->delete_obj(NULL, uid_bucks);
if (ret < 0 && ret != -ENOENT) {
dout(0) << "ERROR: could not remove " << info.user_id << ":" << uid_bucks << ", should be fixed (err=" << ret << ")" << dendl;
return ret;
rgw_obj uid_obj(ui_uid_bucket, info.user_id);
dout(0) << "removing user index: " << info.user_id << dendl;
- ret = rgwstore->delete_obj(NULL, info.user_id, uid_obj);
+ ret = rgwstore->delete_obj(NULL, uid_obj);
if (ret < 0 && ret != -ENOENT) {
dout(0) << "ERROR: could not remove " << info.user_id << ":" << uid_obj << ", should be fixed (err=" << ret << ")" << dendl;
return ret;
*/
extern int rgw_remove_key_index(RGWAccessKey& access_key);
extern int rgw_remove_uid_index(string& uid);
-extern int rgw_remove_email_index(string& uid, string& email);
-extern int rgw_remove_swift_name_index(string& uid, string& swift_name);
+extern int rgw_remove_email_index(string& email);
+extern int rgw_remove_swift_name_index(string& swift_name);
#endif