From dab367f52f9b8d8f01d749fae2502a98d5538df6 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 29 Mar 2010 11:43:45 -0700 Subject: [PATCH] rgw: add optional auid parameter to create_bucket. If set this will set the RADOS pool's auid to the given one, granting partial data coherency. --- src/rgw/rgw_access.h | 2 +- src/rgw/rgw_fs.cc | 2 +- src/rgw/rgw_fs.h | 2 +- src/rgw/rgw_op.cc | 3 ++- src/rgw/rgw_rados.cc | 5 +++-- src/rgw/rgw_rados.h | 5 +++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_access.h b/src/rgw/rgw_access.h index 8fecf350b340f..ce6ef38a4a7e1 100644 --- a/src/rgw/rgw_access.h +++ b/src/rgw/rgw_access.h @@ -40,7 +40,7 @@ public: std::string& marker, std::vector& result, map& common_prefixes) = 0; /** Create a new bucket*/ - virtual int create_bucket(std::string& id, std::string& bucket, map& attrs) = 0; + virtual int create_bucket(std::string& id, std::string& bucket, map& attrs, __u64 auid=0) = 0; /** write an object to the storage device in the appropriate pool with the given stats */ virtual int put_obj(std::string& id, std::string& bucket, std::string& obj, const char *data, size_t size, diff --git a/src/rgw/rgw_fs.cc b/src/rgw/rgw_fs.cc index bff9bcc858189..927432f340b93 100644 --- a/src/rgw/rgw_fs.cc +++ b/src/rgw/rgw_fs.cc @@ -145,7 +145,7 @@ int RGWFS::list_objects(string& id, string& bucket, int max, string& prefix, str } -int RGWFS::create_bucket(std::string& id, std::string& bucket, map& attrs) +int RGWFS::create_bucket(std::string& id, std::string& bucket, map& attrs, __u64 auid) { int len = strlen(DIR_NAME) + 1 + bucket.size() + 1; char buf[len]; diff --git a/src/rgw/rgw_fs.h b/src/rgw/rgw_fs.h index d8aff28e3a859..0092d1fdbc2be 100644 --- a/src/rgw/rgw_fs.h +++ b/src/rgw/rgw_fs.h @@ -13,7 +13,7 @@ public: int list_objects(std::string& id, std::string& bucket, int max, std::string& prefix, std::string& delim, std::string& marker, std::vector& result, map& common_prefixes); - int create_bucket(std::string& id, std::string& bucket, map& attrs); + int create_bucket(std::string& id, std::string& bucket, map& attrs, __u64 auid=0); int put_obj(std::string& id, std::string& bucket, std::string& obj, const char *data, size_t size, time_t *mtime, map& attrs); diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 1c789b79320e1..24899b1c16d96 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -215,7 +215,8 @@ void RGWCreateBucket::execute() attrs[RGW_ATTR_ACL] = aclbl; - ret = rgwstore->create_bucket(s->user.user_id, s->bucket_str, attrs); + ret = rgwstore->create_bucket(s->user.user_id, s->bucket_str, attrs, + s->user.auid); if (ret == 0) { RGWUserBuckets buckets; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 8ef62a3c5570e..84263b39183b8 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -206,9 +206,10 @@ int RGWRados::list_objects(string& id, string& bucket, int max, string& prefix, /** * create a bucket with name bucket and the given list of attrs + * if auid is set, it sets the auid of the underlying rados pool * returns 0 on success, -ERR# otherwise. */ -int RGWRados::create_bucket(std::string& id, std::string& bucket, map& attrs) +int RGWRados::create_bucket(std::string& id, std::string& bucket, map& attrs, __u64 auid) { object_t bucket_oid(bucket.c_str()); @@ -230,7 +231,7 @@ int RGWRados::create_bucket(std::string& id, std::string& bucket, mapcreate_pool(bucket.c_str()); + ret = rados->create_pool(bucket.c_str(), auid); return ret; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index b47d17be49917..4f21ac18f4bc7 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -28,7 +28,8 @@ public: * create a bucket with name bucket and the given list of attrs * returns 0 on success, -ERR# otherwise. */ - int create_bucket(std::string& id, std::string& bucket, map& attrs); + int create_bucket(std::string& id, std::string& bucket, map& attrs, __u64 auid=0); /** Write/overwrite an object to the bucket storage. */ int put_obj(std::string& id, std::string& bucket, std::string& obj, const char *data, size_t size, @@ -52,7 +53,7 @@ public: /** Get the attributes for an object.*/ int get_attr(std::string& bucket, std::string& obj, - const char *name, bufferlist& dest); + const char *name, bufferlist& dest, __u64 auid=0); /** Set an attr on an object. */ int set_attr(std::string& bucket, std::string& obj, -- 2.39.5