]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't specify create_pool and set_marker in create_bucket.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 3 Oct 2011 22:40:35 +0000 (15:40 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 3 Oct 2011 22:40:35 +0000 (15:40 -0700)
It's wildly inappropriate for that kind of implementation detail to
leak out of the interface. For the moment, leave in a "system_bucket"
parameter, which provides the necessary information. But we should
probably be able to push all of that information down below the
interface layer eventually, and then get rid of that param too.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/rgw/rgw_access.h
src/rgw/rgw_admin.cc
src/rgw/rgw_bucket.cc
src/rgw/rgw_fs.cc
src/rgw/rgw_fs.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 068df13663906cf64a67f6e5c9702c1885ff2bae..b7aeb876f49f118bdc8bab551dc68b3d69d9fda0 100644 (file)
@@ -60,7 +60,10 @@ public:
                            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, map<std::string, bufferlist>& attrs, bool create_pool, bool assign_marker, bool exclusive = true, uint64_t auid = 0) = 0;
+  virtual int create_bucket(std::string& id, rgw_bucket& bucket,
+                            map<std::string, bufferlist>& attrs,
+                            bool system_bucket, bool exclusive = true,
+                            uint64_t auid = 0) = 0;
   virtual int select_bucket_placement(string& bucket_name, rgw_bucket& bucket) { return 0; }
   virtual int create_pools(std::string& id, vector<string>& names, vector<int>& retcodes, int auid = 0) { return -ENOTSUP; }
   /** write an object to the storage device in the appropriate pool
index f06f8ba0dc85b14222fb8d27bac01a143ea46fe3..133f339f6c830d0793f457d4e986e79c71a6ac58 100644 (file)
@@ -343,7 +343,7 @@ static int create_bucket(string bucket_str, string& user_id, string& display_nam
 
   rgw_bucket& bucket = bucket_info.bucket;
 
-  ret = rgwstore->create_bucket(user_id, bucket, attrs, false, true, auid);
+  ret = rgwstore->create_bucket(user_id, bucket, attrs, false, auid);
   if (ret && ret != -EEXIST)   
     goto done;
 
index edbca20b957f351db2c81dea74054a76b12444ae..2dd069e7c22522b79e1db954a1661053a1e354ee 100644 (file)
@@ -76,14 +76,14 @@ int rgw_create_bucket(std::string& id, string& bucket_name, rgw_bucket& bucket,
   if (bucket_name[0] == '.') {
     bucket.name = bucket_name;
     bucket.pool = bucket_name;
-    return rgwstore->create_bucket(id, bucket, attrs, true, false, exclusive, auid);
+    return rgwstore->create_bucket(id, bucket, attrs, true, exclusive, auid);
   }
 
   int ret = rgwstore->select_bucket_placement(bucket_name, bucket);
   if (ret < 0)
      return ret;
 
-  ret = rgwstore->create_bucket(id, bucket, attrs, false, true, exclusive, auid);
+  ret = rgwstore->create_bucket(id, bucket, attrs, false, exclusive, auid);
 
   if (ret < 0)
     return ret;
index 6c5d59c9b52492f879643fef6dcc95c339ae74e3..a43991db0ff1fc0391ec9922d5720ac931c682fc 100644 (file)
@@ -170,7 +170,7 @@ int RGWFS::list_objects(string& id, rgw_bucket& bucket, int max, string& prefix,
 }
 
 
-int RGWFS::create_bucket(std::string& id, rgw_bucket& bucket, map<std::string, bufferlist>& attrs, bool create_pool, bool assign_marker, bool exclusive, uint64_t auid)
+int RGWFS::create_bucket(std::string& id, 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];
index 4704ede1e302c8fd16121c48a8165460dfc0c199..e3a9009a4a9a3504bafeb5b8dc4d3d9ec0d0fa8c 100644 (file)
@@ -22,7 +22,7 @@ public:
                    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 create_pool, bool assign_marker, bool exclusive, uint64_t auid=0);
+  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,
              map<std::string, bufferlist>& attrs, RGWObjCategory category, bool exclusive);
   int put_obj_data(void *ctx, std::string& id, rgw_obj& obj, const char *data,
index ba80e6e92e61395b9b01b2731116a616682fc89a..7623640b03b543f2c43ccccfc1de6a2e5fbc9608 100644 (file)
@@ -317,7 +317,7 @@ int RGWRados::list_objects(string& id, rgw_bucket& bucket, int max, string& pref
  */
 int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket, 
                            map<std::string, bufferlist>& attrs, 
-                           bool create_pool, bool assign_marker,
+                           bool system_bucket,
                            bool exclusive, uint64_t auid)
 {
   librados::ObjectWriteOperation op;
@@ -331,15 +331,13 @@ int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket,
   if (ret < 0 && ret != -EEXIST)
     return ret;
 
-  if (create_pool) {
+  if (system_bucket) {
     ret = rados->pool_create(bucket.pool.c_str(), auid);
     if (ret == -EEXIST)
       ret = 0;
     if (ret < 0)
       root_pool_ctx.remove(bucket.name.c_str());
-  }
-
-  if (assign_marker) {
+  } else {
     librados::IoCtx io_ctx; // context for new bucket
 
     int r = open_bucket_ctx(bucket, io_ctx);
index aaf399ba9eff3cb7a8f54f184064ec8181d6d2bc..0d14ae38be05ed181553b44b4e8d3cb4ac8af7cd 100644 (file)
@@ -152,7 +152,10 @@ public:
    * 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, map<std::string,bufferlist>& attrs, bool create_pool, bool assign_marker, bool exclusive = true, uint64_t auid = 0);
+  virtual int create_bucket(std::string& id, rgw_bucket& bucket,
+                            map<std::string,bufferlist>& attrs,
+                            bool system_bucket, bool exclusive = true,
+                            uint64_t auid = 0);
   virtual int select_bucket_placement(std::string& bucket_name, rgw_bucket& bucket);
   virtual int create_pools(std::string& id, vector<string>& names, vector<int>& retcodes, int auid = 0);