]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: refactor RGWHandler HTTP/REST methods into _REST
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 1 Oct 2015 19:58:27 +0000 (15:58 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:02:02 +0000 (12:02 -0500)
This change renames RGWHandler_ObjStore to RGWHandler_REST, and
moves the following protected, virtual, RESTful methods:

  virtual bool is_obj_update_op() { return false; }
  virtual RGWOp *op_get() { return NULL; }
  virtual RGWOp *op_put() { return NULL; }
  virtual RGWOp *op_delete() { return NULL; }
  virtual RGWOp *op_head() { return NULL; }
  virtual RGWOp *op_post() { return NULL; }
  virtual RGWOp *op_copy() { return NULL; }
  virtual RGWOp *op_options() { return NULL; }

and the following public, virtual methods not needed by the
prototyped RGWLibHandler:

  virtual RGWOp *get_op(RGWRados *store);
  virtual void put_op(RGWOp *op);

from RGWHandler into the renamed class.

The motivation for this change is to allow a (maybe) transitional
refactoring stage which allows to implement the RGWHandler
interface, without implementing get_handler() or get_op(), put_op(),
or op_*().

Prior refactoring (which could be reversed) moved authorize() and
read_permissions() into the precursor RGWHandler_ObjStore

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
22 files changed:
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_process.cc
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_bucket.h
src/rgw/rgw_rest_config.h
src/rgw/rgw_rest_lib.cc
src/rgw/rgw_rest_lib.h
src/rgw/rgw_rest_log.h
src/rgw/rgw_rest_metadata.h
src/rgw/rgw_rest_opstate.h
src/rgw/rgw_rest_replica_log.cc
src/rgw/rgw_rest_replica_log.h
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h
src/rgw/rgw_rest_s3website.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h
src/rgw/rgw_rest_usage.h
src/rgw/rgw_rest_user.h
src/rgw/rgw_swift_auth.h

index 4c4fd8dac3a1d88180883e0c6e3c1e723a37ce52..7d46b62d3960cb7d27592018dc3048a7dcb566a5 100644 (file)
@@ -4442,47 +4442,6 @@ int RGWHandler::do_read_permissions(RGWOp *op, bool only_bucket)
   return ret;
 }
 
-
-RGWOp *RGWHandler::get_op(RGWRados *store)
-{
-  RGWOp *op;
-  switch (s->op) {
-   case OP_GET:
-     op = op_get();
-     break;
-   case OP_PUT:
-     op = op_put();
-     break;
-   case OP_DELETE:
-     op = op_delete();
-     break;
-   case OP_HEAD:
-     op = op_head();
-     break;
-   case OP_POST:
-     op = op_post();
-     break;
-   case OP_COPY:
-     op = op_copy();
-     break;
-   case OP_OPTIONS:
-     op = op_options();
-     break;
-   default:
-     return NULL;
-  }
-
-  if (op) {
-    op->init(store, s, this);
-  }
-  return op;
-}
-
-void RGWHandler::put_op(RGWOp *op)
-{
-  delete op;
-}
-
 int RGWOp::error_handler(int err_no, string *error_content) {
   return dialect_handler->error_handler(err_no, error_content);
 }
index d941294beff6e073e794968ddc3da4b094db2b45..f049b73e3c4e49cd307e1fa447aecef9adfa1f22 100644 (file)
@@ -1305,27 +1305,21 @@ protected:
   int do_init_permissions();
   int do_read_permissions(RGWOp *op, bool only_bucket);
 
-  virtual RGWOp *op_get() { return NULL; }
-  virtual RGWOp *op_put() { return NULL; }
-  virtual RGWOp *op_delete() { return NULL; }
-  virtual RGWOp *op_head() { return NULL; }
-  virtual RGWOp *op_post() { return NULL; }
-  virtual RGWOp *op_copy() { return NULL; }
-  virtual RGWOp *op_options() { return NULL; }
 public:
   RGWHandler() : store(NULL), s(NULL) {}
   virtual ~RGWHandler();
-  virtual int init(RGWRados *store, struct req_state *_s, RGWClientIO *cio);
 
-  virtual RGWOp *get_op(RGWRados *store);
-  virtual void put_op(RGWOp *op);
+  virtual int init(RGWRados* store, struct req_state* _s, RGWClientIO* cio);
+
   virtual int init_permissions(RGWOp *op) {
     return 0;
   }
+
   virtual int retarget(RGWOp *op, RGWOp **new_op) {
     *new_op = op;
     return 0;
   }
+
   virtual int read_permissions(RGWOp *op) = 0;
   virtual int authorize() = 0;
   virtual int postauth_init() = 0;
index 241afdfc5941dfc91448687c751d8afefb70d266..3c1321128da7647d8aa3a2028329fa37da4d7d56 100644 (file)
@@ -63,10 +63,9 @@ int process_request(RGWRados* store, RGWREST* rest, RGWRequest* req,
   RGWOp* op = NULL;
   int init_error = 0;
   bool should_log = false;
-
-  RGWRESTMgr* mgr;
-  RGWHandler* handler = rest->get_handler(store, s, client_io, &mgr,
-                                         &init_error);
+  RGWRESTMgr *mgr;
+  RGWHandler_REST *handler = rest->get_handler(store, s, client_io, &mgr,
+                                             &init_error);
   if (init_error != 0) {
     abort_early(s, NULL, init_error, NULL);
     goto done;
index f869cac32b7178d0159dce9cff109ca880cdddaa..0c4be38d9aa7e18bd2eebb652e8b88547759def2 100644 (file)
@@ -1253,9 +1253,49 @@ int RGWRESTOp::verify_permission()
   return check_caps(s->user.caps);
 }
 
-int RGWHandler_ObjStore::allocate_formatter(struct req_state *s,
-                                           int default_type,
-                                           bool configurable)
+RGWOp* RGWHandler_REST::get_op(RGWRados* store)
+{
+  RGWOp *op;
+  switch (s->op) {
+   case OP_GET:
+     op = op_get();
+     break;
+   case OP_PUT:
+     op = op_put();
+     break;
+   case OP_DELETE:
+     op = op_delete();
+     break;
+   case OP_HEAD:
+     op = op_head();
+     break;
+   case OP_POST:
+     op = op_post();
+     break;
+   case OP_COPY:
+     op = op_copy();
+     break;
+   case OP_OPTIONS:
+     op = op_options();
+     break;
+   default:
+     return NULL;
+  }
+
+  if (op) {
+    op->init(store, s, this);
+  }
+  return op;
+} /* get_op */
+
+void RGWHandler_REST::put_op(RGWOp* op)
+{
+  delete op;
+} /* put_op */
+
+int RGWHandler_REST::allocate_formatter(struct req_state *s,
+                                       int default_type,
+                                       bool configurable)
 {
   s->format = default_type;
   if (configurable) {
@@ -1317,20 +1357,21 @@ int RGWHandler_ObjStore::allocate_formatter(struct req_state *s,
   return 0;
 }
 
-int RGWHandler_ObjStore::validate_tenant_name(string const& t)
+int RGWHandler_REST::validate_tenant_name(string const& t)
 {
-  const char *p = t.c_str();
-  for (unsigned int i = 0; i < t.size(); i++) {
-    char ch = p[i];
-    if (!(isalnum(ch) || ch == '_'))
-      return -ERR_INVALID_TENANT_NAME;
-  }
-  return 0;
+  struct tench {
+    static bool is_good(char ch) {
+      return isalnum(ch) || ch == '_';
+    }
+  };
+  std::string::const_iterator it =
+    std::find_if_not(t.begin(), t.end(), tench::is_good);
+  return (it == t.end())? 0: -ERR_INVALID_TENANT_NAME;
 }
 
 // This function enforces Amazon's spec for bucket names.
 // (The requirements, not the recommendations.)
-int RGWHandler_ObjStore::validate_bucket_name(const string& bucket)
+int RGWHandler_REST::validate_bucket_name(const string& bucket)
 {
   int len = bucket.size();
   if (len < 3) {
@@ -1353,7 +1394,7 @@ int RGWHandler_ObjStore::validate_bucket_name(const string& bucket)
 // is at most 1024 bytes long."
 // However, we can still have control characters and other nasties in there.
 // Just as long as they're utf-8 nasties.
-int RGWHandler_ObjStore::validate_object_name(const string& object)
+int RGWHandler_REST::validate_object_name(const string& object)
 {
   int len = object.size();
   if (len > 1024) {
@@ -1390,7 +1431,7 @@ static http_op op_from_method(const char *method)
   return OP_UNKNOWN;
 }
 
-int RGWHandler_ObjStore::init_permissions(RGWOp *op)
+int RGWHandler_REST::init_permissions(RGWOp* op)
 {
   if (op->get_type() == RGW_OP_CREATE_BUCKET)
     return 0;
@@ -1398,7 +1439,7 @@ int RGWHandler_ObjStore::init_permissions(RGWOp *op)
   return do_init_permissions();
 }
 
-int RGWHandler_ObjStore::read_permissions(RGWOp *op_obj)
+int RGWHandler_REST::read_permissions(RGWOp* op_obj)
 {
   bool only_bucket;
 
@@ -1714,11 +1755,11 @@ int RGWREST::preprocess(struct req_state *s, RGWClientIO* cio)
   return 0;
 }
 
-RGWHandler *RGWREST::get_handler(RGWRados *store, struct req_state *s,
-                                RGWStreamIO *sio, RGWRESTMgr **pmgr,
-                                int *init_error)
+RGWHandler_REST* RGWREST::get_handler(RGWRados *store, struct req_state *s,
+                                     RGWStreamIO *sio, RGWRESTMgr **pmgr,
+                                     int *init_error)
 {
-  RGWHandler *handler;
+  RGWHandler_REST* handler;
 
   *init_error = preprocess(s, sio);
   if (*init_error < 0)
index dcb6def80d3fb7829dd493fe2fe03c8aa02e7c6d..2d390684a590d24d61b0dae8c384daf6ff9e0c31 100644 (file)
@@ -359,7 +359,7 @@ public:
   virtual int verify_permission();
 };
 
-class RGWHandler_ObjStore : public RGWHandler {
+class RGWHandler_REST : public RGWHandler {
 protected:
   virtual bool is_obj_update_op() { return false; }
   virtual RGWOp *op_get() { return NULL; }
@@ -377,11 +377,16 @@ protected:
   static int allocate_formatter(struct req_state *s, int default_formatter,
                                bool configurable);
 public:
-  RGWHandler_ObjStore() {}
-  virtual ~RGWHandler_ObjStore() {}
-  int init_permissions(RGWOp *op);
-  int read_permissions(RGWOp *op);
-  virtual int retarget(RGWOp *op, RGWOp **new_op) {
+  RGWHandler_REST() {}
+  virtual ~RGWHandler_REST() {}
+
+  int init_permissions(RGWOp* op);
+  int read_permissions(RGWOp* op);
+
+  virtual RGWOp* get_op(RGWRados* store);
+  virtual void put_op(RGWOp* op);
+
+  virtual int retarget(RGWOp* op, RGWOp** new_op) {
     *new_op = op;
     return 0;
   }
@@ -390,9 +395,9 @@ public:
   // virtual int postauth_init(struct req_init_state *t) = 0;
 };
 
-class RGWHandler_ObjStore_SWIFT;
+class RGWHandler_REST_SWIFT;
 class RGWHandler_SWIFT_Auth;
-class RGWHandler_ObjStore_S3;
+class RGWHandler_REST_S3;
 
 
 class RGWRESTMgr {
@@ -411,8 +416,8 @@ public:
 
   virtual RGWRESTMgr *get_resource_mgr(struct req_state *s, const string& uri,
                                       string *out_uri);
-  virtual RGWHandler *get_handler(struct req_state *s) { return NULL; }
-  virtual void put_handler(RGWHandler *handler) { delete handler; }
+  virtual RGWHandler_REST *get_handler(struct req_state *s) { return NULL; }
+  virtual void put_handler(RGWHandler_REST *handler) { delete handler; }
 
   void set_logging(bool _should_log) { should_log = _should_log; }
   bool get_logging() { return should_log; }
@@ -426,13 +431,15 @@ class RGWREST {
   static int preprocess(struct req_state *s, RGWClientIO *sio);
 public:
   RGWREST() {}
-  RGWHandler *get_handler(RGWRados *store, struct req_state *s,
-                         RGWStreamIO *sio,
-                         RGWRESTMgr **pmgr, int *init_error);
+  RGWHandler_REST *get_handler(RGWRados *store, struct req_state *s,
+                             RGWStreamIO *sio,
+                             RGWRESTMgr **pmgr, int *init_error);
+#if 0
   RGWHandler *get_handler(RGWRados *store, struct req_state *s,
                          RGWLibIO *io, RGWRESTMgr **pmgr,
                          int *init_error);
-  void put_handler(RGWHandler *handler) {
+#endif
+  void put_handler(RGWHandler_REST *handler) {
     mgr.put_handler(handler);
   }
 
index 542bec644ef95aa06dac79e09e5b7ce3b66ce51b..227ef914d3af3bff19c9b24cc35d0a76e1c410c3 100644 (file)
@@ -28,7 +28,7 @@ public:
   RGWRESTMgr_Bucket() {}
   virtual ~RGWRESTMgr_Bucket() {}
 
-  RGWHandler *get_handler(struct req_state *s) {
+  RGWHandler_REST* get_handler(struct req_state *s) {
     return new RGWHandler_Bucket;
   }
 };
index 2e0408afb3d023a44585d4b5dec9ab21e757abfe..143e4cb8705c266706a773eaccd62575abb8960c 100644 (file)
@@ -11,8 +11,9 @@
  * Foundation. See file COPYING.
  *
  */
-#ifndef CEPH_RGW_REST_CONFIG_H
-#define CEPH_RGW_REST_CONFIG_H
+
+#ifndef RGW_REST_CONFIG_H
+#define RGW_REST_CONFIG_H
 
 class RGWOp_RegionMap_Get : public RGWRESTOp {
   RGWRegionMap regionmap;
@@ -47,9 +48,9 @@ public:
   RGWRESTMgr_Config() {}
   virtual ~RGWRESTMgr_Config() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s){
+  virtual RGWHandler_REST* get_handler(struct req_state *s){
     return new RGWHandler_Config;
   }
 };
 
-#endif
+#endif /* RGW_REST_CONFIG_H */
index ccfc8616fd370385af6b354e178447f19bf73fbc..d0edb1b9ff7556e5d9fa67018f2e0a667bb468d7 100644 (file)
@@ -10,7 +10,7 @@
 /* XXX going away ! */
 
 /* static */
-int RGWHandler_ObjStore_Lib::init_from_header(struct req_state *s)
+int RGWHandler_REST_Lib::init_from_header(struct req_state *s)
 {
   string req;
   string first;
index bcc78d3bff859e89499a34d52b69eeb9071331a3..34cbd2ae90deadd7af24e6238b8a0614a50d1646 100644 (file)
@@ -15,11 +15,14 @@ class RGWRESTMgr_Lib : public RGWRESTMgr {
 public:
   RGWRESTMgr_Lib() {}
   virtual ~RGWRESTMgr_Lib() {}
+ #warning remove this
+#if 0
   virtual RGWHandler* get_handler(struct req_state* s) { return nullptr; }
+#endif
 }; /* RGWRESTMgr_Lib */
 
 /* rgw_lib RGWHandler */
-class RGWHandler_ObjStore_Lib : public RGWHandler_ObjStore {
+class RGWHandler_REST_Lib : public RGWHandler_REST {
   friend class RGWRESTMgr_Lib;
 public:
 
@@ -27,10 +30,10 @@ public:
     return RGW_Auth_S3::authorize(store, s);
   }
 
-  RGWHandler_ObjStore_Lib() {}
-  virtual ~RGWHandler_ObjStore_Lib() {}
+  RGWHandler_REST_Lib() {}
+  virtual ~RGWHandler_REST_Lib() {}
   static int init_from_header(struct req_state *s);
-}; /* RGWHandler_ObjStore_Lib */
+}; /* RGWHandler_REST_Lib */
 
 
 /* RGWOps */
index d6873bd8fed2567ff788922e4285a7c53f674149..e1df68b6a2c521f60d833adda8930c5161651327 100644 (file)
@@ -11,8 +11,9 @@
  * Foundation. See file COPYING.
  *
  */
-#ifndef CEPH_RGW_REST_LOG_H
-#define CEPH_RGW_REST_LOG_H
+
+#ifndef RGW_REST_LOG_H
+#define RGW_REST_LOG_H
 
 #include "rgw_metadata.h"
 
@@ -293,10 +294,9 @@ public:
   RGWRESTMgr_Log() {}
   virtual ~RGWRESTMgr_Log() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s){
+  virtual RGWHandler_REST* get_handler(struct req_state *s){
     return new RGWHandler_Log;
   }
 };
 
-#endif
-
+#endif /* RGW_REST_LOG_H */
index 7f3cf1f2207aefd421b2f1e93051164c3651d55e..90e1ebff36f61e16b8a6c7c8cfbc667d57709fad 100644 (file)
@@ -11,8 +11,9 @@
  * Foundation. See file COPYING.
  *
  */
-#ifndef CEPH_RGW_REST_METADATA_H
-#define CEPH_RGW_REST_METADATA_H
+
+#ifndef RGW_REST_METADATA_H
+#define RGW_REST_METADATA_H
 
 class RGWOp_Metadata_List : public RGWRESTOp {
 public:
@@ -114,10 +115,9 @@ public:
   RGWRESTMgr_Metadata() {}
   virtual ~RGWRESTMgr_Metadata() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s){
+  virtual RGWHandler_REST* get_handler(struct req_state *s){
     return new RGWHandler_Metadata;
   }
 };
 
-
-#endif
+#endif /* RGW_REST_METADATA_H */
index de13dde6966b4785e8e62ab1007cb1ca23600f88..92814f4e027e62e8bfbf40550f2079a2b8e42963 100644 (file)
@@ -11,8 +11,9 @@
  * Foundation. See file COPYING.
  *
  */
-#ifndef CEPH_RGW_REST_OPSTATE_H
-#define CEPH_RGW_REST_OPSTATE_H
+
+#ifndef RGW_REST_OPSTATE_H
+#define RGW_REST_OPSTATE_H
 
 class RGWOp_Opstate_List : public RGWRESTOp {
   bool sent_header;
@@ -100,10 +101,9 @@ public:
   RGWRESTMgr_Opstate() {}
   virtual ~RGWRESTMgr_Opstate() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s){
+  virtual RGWHandler_REST* get_handler(struct req_state *s){
     return new RGWHandler_Opstate;
   }
 };
 
-#endif /*!CEPH_RGW_REST_OPSTATE_H*/
-
+#endif /*!RGW_REST_OPSTATE_H*/
index 74b45490e294903860de6233d6828e94eada9d62..23a75fe30bfce560239350601dd26edab467e1f2 100644 (file)
@@ -37,7 +37,6 @@ static int parse_to_utime(string& in, utime_t& out) {
   return 0;
 }
 
-
 void RGWOp_OBJLog_SetBounds::execute() {
   string id_str = s->info.args.get("id"),
          marker = s->info.args.get("marker"),
index c879150cc07e94487131aa611a8ddf9b868a2d5e..4be951178b1f370ca76792e468fd0193933dc800 100644 (file)
@@ -11,8 +11,9 @@
  * Foundation. See file COPYING.
  *
  */
-#ifndef CEPH_RGW_REST_REPLICA_LOG_H
-#define CEPH_RGW_REST_REPLICA_LOG_H
+
+#ifndef RGW_REST_REPLICA_LOG_H
+#define RGW_REST_REPLICA_LOG_H
 
 class RGWOp_OBJLog_GetBounds : public RGWRESTOp {
   string prefix;
@@ -146,9 +147,9 @@ public:
   RGWRESTMgr_ReplicaLog() {}
   virtual ~RGWRESTMgr_ReplicaLog() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s){
+  virtual RGWHandler_REST* get_handler(struct req_state *s){
     return new RGWHandler_ReplicaLog;
   }
 };
 
-#endif /*!CEPH_RGW_REST_REPLICA_LOG_H*/
+#endif /*!RGW_REST_REPLICA_LOG_H*/
index 578f71e02196d988c997a073565b92a470361d94..dada6488fca53e3978411ebd13b6c0b512311061 100644 (file)
@@ -2251,17 +2251,17 @@ void RGWDeleteMultiObj_ObjStore_S3::end_response()
   rgw_flush_formatter_and_reset(s, s->formatter);
 }
 
-RGWOp *RGWHandler_ObjStore_Service_S3::op_get()
+RGWOp *RGWHandler_REST_Service_S3::op_get()
 {
   return new RGWListBuckets_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Service_S3::op_head()
+RGWOp *RGWHandler_REST_Service_S3::op_head()
 {
   return new RGWListBuckets_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::get_obj_op(bool get_data)
+RGWOp *RGWHandler_REST_Bucket_S3::get_obj_op(bool get_data)
 {
   // Non-website mode
   if (get_data)
@@ -2270,7 +2270,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::get_obj_op(bool get_data)
     return new RGWStatBucket_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::op_get()
+RGWOp *RGWHandler_REST_Bucket_S3::op_get()
 {
   if (s->info.args.sub_resource_exists("logging"))
     return new RGWGetBucketLogging_ObjStore_S3;
@@ -2300,7 +2300,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_get()
   return get_obj_op(true);
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::op_head()
+RGWOp *RGWHandler_REST_Bucket_S3::op_head()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_S3;
@@ -2310,7 +2310,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_head()
   return get_obj_op(false);
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::op_put()
+RGWOp *RGWHandler_REST_Bucket_S3::op_put()
 {
   if (s->info.args.sub_resource_exists("logging"))
     return NULL;
@@ -2332,7 +2332,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_put()
   return new RGWCreateBucket_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::op_delete()
+RGWOp *RGWHandler_REST_Bucket_S3::op_delete()
 {
   if (is_cors_op()) {
     return new RGWDeleteCORS_ObjStore_S3;
@@ -2348,7 +2348,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_delete()
   return new RGWDeleteBucket_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::op_post()
+RGWOp *RGWHandler_REST_Bucket_S3::op_post()
 {
   if ( s->info.request_params == "delete" ) {
     return new RGWDeleteMultiObj_ObjStore_S3;
@@ -2357,12 +2357,12 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_post()
   return new RGWPostObj_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3::op_options()
+RGWOp *RGWHandler_REST_Bucket_S3::op_options()
 {
   return new RGWOptionsCORS_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::get_obj_op(bool get_data)
+RGWOp *RGWHandler_REST_Obj_S3::get_obj_op(bool get_data)
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_S3;
@@ -2372,7 +2372,7 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::get_obj_op(bool get_data)
   return get_obj_op;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::op_get()
+RGWOp *RGWHandler_REST_Obj_S3::op_get()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_S3;
@@ -2382,7 +2382,7 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::op_get()
   return get_obj_op(true);
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::op_head()
+RGWOp *RGWHandler_REST_Obj_S3::op_head()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_S3;
@@ -2392,7 +2392,7 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::op_head()
   return get_obj_op(false);
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::op_put()
+RGWOp *RGWHandler_REST_Obj_S3::op_put()
 {
   if (is_acl_op()) {
     return new RGWPutACLs_ObjStore_S3;
@@ -2403,7 +2403,7 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::op_put()
     return new RGWCopyObj_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::op_delete()
+RGWOp *RGWHandler_REST_Obj_S3::op_delete()
 {
   string upload_id = s->info.args.get("uploadId");
 
@@ -2413,7 +2413,7 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::op_delete()
     return new RGWAbortMultipart_ObjStore_S3;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::op_post()
+RGWOp *RGWHandler_REST_Obj_S3::op_post()
 {
   if (s->info.args.exists("uploadId"))
     return new RGWCompleteMultipart_ObjStore_S3;
@@ -2424,14 +2424,14 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::op_post()
   return NULL;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3::op_options()
+RGWOp *RGWHandler_REST_Obj_S3::op_options()
 {
   return new RGWOptionsCORS_ObjStore_S3;
 }
 
-int RGWHandler_ObjStore_S3::init_from_header(struct req_state *s,
-                                            int default_formatter,
-                                            bool configurable_format)
+int RGWHandler_REST_S3::init_from_header(struct req_state* s,
+                                       int default_formatter,
+                                       bool configurable_format)
 {
   string req;
   string first;
@@ -2493,7 +2493,7 @@ int RGWHandler_ObjStore_S3::init_from_header(struct req_state *s,
   return 0;
 }
 
-int RGWHandler_ObjStore_S3::postauth_init()
+int RGWHandler_REST_S3::postauth_init()
 {
   struct req_init_state *t = &s->init_state;
   bool relaxed_names = s->cct->_conf->rgw_relaxed_s3_bucket_names;
@@ -2549,10 +2549,10 @@ static bool looks_like_ip_address(const char *bucket)
   return (num_periods == 3);
 }
 
-int RGWHandler_ObjStore_S3::validate_bucket_name(const string& bucket,
+int RGWHandler_REST_S3::validate_bucket_name(const string& bucket,
                                                 bool relaxed_names)
 {
-  int ret = RGWHandler_ObjStore::validate_bucket_name(bucket);
+  int ret = RGWHandler_REST::validate_bucket_name(bucket);
   if (ret < 0)
     return ret;
 
@@ -2585,7 +2585,7 @@ int RGWHandler_ObjStore_S3::validate_bucket_name(const string& bucket,
   return 0;
 }
 
-int RGWHandler_ObjStore_S3::init(RGWRados *store, struct req_state *s,
+int RGWHandler_REST_S3::init(RGWRados *store, struct req_state *s,
                                 RGWClientIO *cio)
 {
   int ret;
@@ -2609,7 +2609,7 @@ int RGWHandler_ObjStore_S3::init(RGWRados *store, struct req_state *s,
     }
   }
 
-  return RGWHandler_ObjStore::init(store, s, cio);
+  return RGWHandler_REST::init(store, s, cio);
 }
 
 /*
@@ -2901,46 +2901,50 @@ int RGW_Auth_S3::authorize(RGWRados *store, struct req_state *s)
 int RGWHandler_Auth_S3::init(RGWRados *store, struct req_state *state,
                             RGWClientIO *cio)
 {
-  int ret = RGWHandler_ObjStore_S3::init_from_header(state, RGW_FORMAT_JSON,
+  int ret = RGWHandler_REST_S3::init_from_header(state, RGW_FORMAT_JSON,
                                                     true);
   if (ret < 0)
     return ret;
 
-  return RGWHandler_ObjStore::init(store, state, cio);
+  return RGWHandler_REST::init(store, state, cio);
 }
 
-RGWHandler *RGWRESTMgr_S3::get_handler(struct req_state *s)
+RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state *s)
 {
   bool is_s3website = enable_s3website && (s->prot_flags & RGW_REST_WEBSITE);
-  int ret = RGWHandler_ObjStore_S3::init_from_header(s, is_s3website ? RGW_FORMAT_HTML : RGW_FORMAT_XML, false);
+  int ret =
+    RGWHandler_REST_S3::init_from_header(s,
+                                       is_s3website ? RGW_FORMAT_HTML :
+                                       RGW_FORMAT_XML, false);
   if (ret < 0)
     return NULL;
 
-  RGWHandler* handler;
+  RGWHandler_REST* handler;
   // TODO: Make this more readable
   if (is_s3website) {
     if (s->init_state.url_bucket.empty()) {
-      handler = new RGWHandler_ObjStore_Service_S3Website;
+      handler = new RGWHandler_REST_Service_S3Website;
     } else if (s->object.empty()) {
-      handler = new RGWHandler_ObjStore_Bucket_S3Website;
+      handler = new RGWHandler_REST_Bucket_S3Website;
     } else {
-      handler = new RGWHandler_ObjStore_Obj_S3Website;
+      handler = new RGWHandler_REST_Obj_S3Website;
     }
   } else {
     if (s->init_state.url_bucket.empty()) {
-      handler = new RGWHandler_ObjStore_Service_S3;
+      handler = new RGWHandler_REST_Service_S3;
     } else if (s->object.empty()) {
-      handler = new RGWHandler_ObjStore_Bucket_S3;
+      handler = new RGWHandler_REST_Bucket_S3;
     } else {
-      handler = new RGWHandler_ObjStore_Obj_S3;
+      handler = new RGWHandler_REST_Obj_S3;
     }
   }
 
-  ldout(s->cct, 20) << __func__ << " handler=" << typeid(*handler).name() << dendl;
+  ldout(s->cct, 20) << __func__ << " handler=" << typeid(*handler).name()
+                   << dendl;
   return handler;
 }
 
-int RGWHandler_ObjStore_S3Website::retarget(RGWOp *op, RGWOp **new_op) {
+int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op) {
   *new_op = op;
   ldout(s->cct, 10) << __func__ << "Starting retarget" << dendl;
 
@@ -2948,7 +2952,9 @@ int RGWHandler_ObjStore_S3Website::retarget(RGWOp *op, RGWOp **new_op) {
     return 0;
 
   RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-  int ret = store->get_bucket_info(obj_ctx, s->bucket_tenant, s->bucket_name, s->bucket_info, NULL, &s->bucket_attrs);
+  int ret = store->get_bucket_info(obj_ctx, s->bucket_tenant,
+                                 s->bucket_name, s->bucket_info, NULL,
+                                 &s->bucket_attrs);
   if (ret < 0) {
       // TODO-FUTURE: if the bucket does not exist, maybe expose it here?
       return -ERR_NO_SUCH_BUCKET;
@@ -2960,26 +2966,32 @@ int RGWHandler_ObjStore_S3Website::retarget(RGWOp *op, RGWOp **new_op) {
 
   rgw_obj_key new_obj;
   s->bucket_info.website_conf.get_effective_key(s->object.name, &new_obj.name);
-  ldout(s->cct, 10) << "retarget get_effective_key " << s->object << " -> " << new_obj << dendl;
+  ldout(s->cct, 10) << "retarget get_effective_key " << s->object << " -> "
+                   << new_obj << dendl;
 
   RGWBWRoutingRule rrule;
-  bool should_redirect = s->bucket_info.website_conf.should_redirect(new_obj.name, 0, &rrule);
+  bool should_redirect =
+    s->bucket_info.website_conf.should_redirect(new_obj.name, 0, &rrule);
 
   if (should_redirect) {
     const string& hostname = s->info.env->get("HTTP_HOST", "");
-    const string& protocol = (s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
+    const string& protocol =
+      (s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
     int redirect_code = 0;
-    rrule.apply_rule(protocol, hostname, s->object.name, &s->redirect, &redirect_code);
+    rrule.apply_rule(protocol, hostname, s->object.name, &s->redirect,
+                   &redirect_code);
     // APply a custom HTTP response code
     if (redirect_code > 0)
       s->err.http_ret = redirect_code; // Apply a custom HTTP response code
-    ldout(s->cct, 10) << "retarget redirect code=" << redirect_code << " proto+host:" << protocol << "://" << hostname << " -> " << s->redirect << dendl;
+    ldout(s->cct, 10) << "retarget redirect code=" << redirect_code
+                     << " proto+host:" << protocol << "://" << hostname
+                     << " -> " << s->redirect << dendl;
     return -ERR_WEBSITE_REDIRECT;
   }
 
   /*
-   * FIXME: if s->object != new_obj, drop op and create a new op to handle operation. Or
-   * remove this comment if it's not applicable anymore
+   * FIXME: if s->object != new_obj, drop op and create a new op to handle
+   * operation. Or remove this comment if it's not applicable anymore
    */
 
   s->object = new_obj;
@@ -2987,52 +2999,57 @@ int RGWHandler_ObjStore_S3Website::retarget(RGWOp *op, RGWOp **new_op) {
   return 0;
 }
 
-RGWOp *RGWHandler_ObjStore_S3Website::op_get()
+RGWOp* RGWHandler_REST_S3Website::op_get()
 {
   return get_obj_op(true);
 }
 
-RGWOp *RGWHandler_ObjStore_S3Website::op_head()
+RGWOp* RGWHandler_REST_S3Website::op_head()
 {
   return get_obj_op(false);
 }
 
-int RGWHandler_ObjStore_S3Website::get_errordoc(const string& errordoc_key, string *error_content) {
-    ldout(s->cct, 20) << "TODO Serve Custom error page here if bucket has <Error>" << dendl;
-    *error_content = errordoc_key;
-    // 1. Check if errordoc exists
-    // 2. Check if errordoc is public
-    // 3. Fetch errordoc content
-    /*
-     * FIXME maybe:  need to make sure all of the fields for conditional requests are cleared
-     */
-    RGWGetObj_ObjStore_S3Website *getop = new RGWGetObj_ObjStore_S3Website(true);
-    getop->set_get_data(true);
-    getop->init(store, s, this);
-
-    RGWGetObj_CB cb(getop);
-    rgw_obj obj(s->bucket, errordoc_key);
-    RGWObjectCtx rctx(store);
-    //RGWRados::Object op_target(store, s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
-    RGWRados::Object op_target(store, s->bucket_info, rctx, obj);
-    RGWRados::Object::Read read_op(&op_target);
-
-    int ret;
-    int64_t ofs = 0; 
-    int64_t end = -1;
-    ret = read_op.prepare(&ofs, &end);
-    if (ret < 0) {
-      goto done;
-    }
+int RGWHandler_REST_S3Website::get_errordoc(const string& errordoc_key,
+                                           std::string* error_content) {
+  ldout(s->cct, 20) << "TODO Serve Custom error page here if bucket has "
+    "<Error>" << dendl;
+  *error_content = errordoc_key;
+  // 1. Check if errordoc exists
+  // 2. Check if errordoc is public
+  // 3. Fetch errordoc content
+  /*
+   * FIXME maybe:  need to make sure all of the fields for conditional
+   * requests are cleared
+   */
+  RGWGetObj_ObjStore_S3Website* getop =
+    new RGWGetObj_ObjStore_S3Website(true);
+  getop->set_get_data(true);
+  getop->init(store, s, this);
+
+  RGWGetObj_CB cb(getop);
+  rgw_obj obj(s->bucket, errordoc_key);
+  RGWObjectCtx rctx(store);
+  //RGWRados::Object op_target(store, s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
+  RGWRados::Object op_target(store, s->bucket_info, rctx, obj);
+  RGWRados::Object::Read read_op(&op_target);
 
-    ret = read_op.iterate(ofs, end, &cb); // FIXME: need to know the final size?
+  int ret;
+  int64_t ofs = 0; 
+  int64_t end = -1;
+  ret = read_op.prepare(&ofs, &end);
+  if (ret < 0) {
+    goto done;
+  }
+
+  ret = read_op.iterate(ofs, end, &cb); // FIXME: need to know the final size?
 done:
-    delete getop;
-    return ret;
+  delete getop;
+  return ret;
 }
   
-int RGWHandler_ObjStore_S3Website::error_handler(int err_no, string *error_content) {
-  const struct rgw_http_errors *r;
+int RGWHandler_REST_S3Website::error_handler(int err_no,
+                                           string* error_content) {
+  const struct rgw_http_errors* r;
   int http_error_code = -1;
   r = search_err(err_no, RGW_HTTP_ERRORS, ARRAY_LEN(RGW_HTTP_ERRORS));
   if (r) {
@@ -3040,20 +3057,27 @@ int RGWHandler_ObjStore_S3Website::error_handler(int err_no, string *error_conte
   }
 
   RGWBWRoutingRule rrule;
-  bool should_redirect = s->bucket_info.website_conf.should_redirect(s->object.name, http_error_code, &rrule);
+  bool should_redirect =
+    s->bucket_info.website_conf.should_redirect(s->object.name, http_error_code,
+                                               &rrule);
 
   if (should_redirect) {
     const string& hostname = s->info.env->get("HTTP_HOST", "");
-    const string& protocol = (s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
+    const string& protocol =
+      (s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
     int redirect_code = 0;
-    rrule.apply_rule(protocol, hostname, s->object.name, &s->redirect, &redirect_code);
-    // APply a custom HTTP response code
+    rrule.apply_rule(protocol, hostname, s->object.name, &s->redirect,
+                   &redirect_code);
+    // Apply a custom HTTP response code
     if (redirect_code > 0)
       s->err.http_ret = redirect_code; // Apply a custom HTTP response code
-    ldout(s->cct, 10) << "error handler redirect code=" << redirect_code << " proto+host:" << protocol << "://" << hostname << " -> " << s->redirect << dendl;
+    ldout(s->cct, 10) << "error handler redirect code=" << redirect_code
+                     << " proto+host:" << protocol << "://" << hostname
+                     << " -> " << s->redirect << dendl;
     return -ERR_WEBSITE_REDIRECT;
   } else if (!s->bucket_info.website_conf.error_doc.empty()) {
-    RGWHandler_ObjStore_S3Website::get_errordoc(s->bucket_info.website_conf.error_doc, error_content);
+    RGWHandler_REST_S3Website::get_errordoc(
+      s->bucket_info.website_conf.error_doc, error_content);
   } else {
     ldout(s->cct, 20) << "No special error handling today!" << dendl;
   }
@@ -3061,35 +3085,35 @@ int RGWHandler_ObjStore_S3Website::error_handler(int err_no, string *error_conte
   return err_no;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_S3Website::get_obj_op(bool get_data)
+RGWOp* RGWHandler_REST_Obj_S3Website::get_obj_op(bool get_data)
 {
   /** If we are in website mode, then it is explicitly impossible to run GET or
    * HEAD on the actual directory. We must convert the request to run on the
    * suffix object instead!
    */
-  RGWGetObj_ObjStore_S3Website *op = new RGWGetObj_ObjStore_S3Website;
+  RGWGetObj_ObjStore_S3Websiteop = new RGWGetObj_ObjStore_S3Website;
   op->set_get_data(get_data);
   return op;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_S3Website::get_obj_op(bool get_data)
+RGWOp* RGWHandler_REST_Bucket_S3Website::get_obj_op(bool get_data)
 {
   /** If we are in website mode, then it is explicitly impossible to run GET or
    * HEAD on the actual directory. We must convert the request to run on the
    * suffix object instead!
    */
-  RGWGetObj_ObjStore_S3Website *op = new RGWGetObj_ObjStore_S3Website;
+  RGWGetObj_ObjStore_S3Websiteop = new RGWGetObj_ObjStore_S3Website;
   op->set_get_data(get_data);
   return op;
 }
 
-RGWOp *RGWHandler_ObjStore_Service_S3Website::get_obj_op(bool get_data)
+RGWOp* RGWHandler_REST_Service_S3Website::get_obj_op(bool get_data)
 {
   /** If we are in website mode, then it is explicitly impossible to run GET or
    * HEAD on the actual directory. We must convert the request to run on the
    * suffix object instead!
    */
-  RGWGetObj_ObjStore_S3Website *op = new RGWGetObj_ObjStore_S3Website;
+  RGWGetObj_ObjStore_S3Websiteop = new RGWGetObj_ObjStore_S3Website;
   op->set_get_data(get_data);
   return op;
 }
index 98feab31a583d8a7e6b409fbbc569e88b43e8069..cde8581ef88b03d87b95ca83f33dbaff6714760b 100644 (file)
@@ -388,10 +388,10 @@ public:
   static int authorize(RGWRados *store, struct req_state *s);
 };
 
-class RGWHandler_Auth_S3 : public RGWHandler_ObjStore {
+class RGWHandler_Auth_S3 : public RGWHandler_REST {
   friend class RGWRESTMgr_S3;
 public:
-  RGWHandler_Auth_S3() : RGWHandler_ObjStore() {}
+  RGWHandler_Auth_S3() : RGWHandler_REST() {}
   virtual ~RGWHandler_Auth_S3() {}
 
   virtual int validate_bucket_name(const string& bucket) {
@@ -407,16 +407,18 @@ public:
   int postauth_init() { return 0; }
 };
 
-class RGWHandler_ObjStore_S3 : public RGWHandler_ObjStore {
+class RGWHandler_REST_S3 : public RGWHandler_REST {
   friend class RGWRESTMgr_S3;
 public:
   static int init_from_header(struct req_state *s, int default_formatter, bool configurable_format);
 
-  RGWHandler_ObjStore_S3() : RGWHandler_ObjStore() {}
-  virtual ~RGWHandler_ObjStore_S3() {}
+  RGWHandler_REST_S3() : RGWHandler_REST() {}
+  virtual ~RGWHandler_REST_S3() {}
 
   int validate_bucket_name(const string& bucket, bool relaxed_names);
-  using RGWHandler_ObjStore::validate_bucket_name;
+  int get_errordoc(const string& errordoc_key, string* error_content);
+
+  using RGWHandler_REST::validate_bucket_name;
   
   virtual int init(RGWRados *store, struct req_state *s, RGWClientIO *cio);
   virtual int authorize() {
@@ -429,16 +431,16 @@ public:
   }
 };
 
-class RGWHandler_ObjStore_Service_S3 : public RGWHandler_ObjStore_S3 {
+class RGWHandler_REST_Service_S3 : public RGWHandler_REST_S3 {
 protected:
   RGWOp *op_get();
   RGWOp *op_head();
 public:
-  RGWHandler_ObjStore_Service_S3() {}
-  virtual ~RGWHandler_ObjStore_Service_S3() {}
+  RGWHandler_REST_Service_S3() {}
+  virtual ~RGWHandler_REST_Service_S3() {}
 };
 
-class RGWHandler_ObjStore_Bucket_S3 : public RGWHandler_ObjStore_S3 {
+class RGWHandler_REST_Bucket_S3 : public RGWHandler_REST_S3 {
 protected:
   bool is_acl_op() {
     return s->info.args.exists("acl");
@@ -461,11 +463,11 @@ protected:
   RGWOp *op_post();
   RGWOp *op_options();
 public:
-  RGWHandler_ObjStore_Bucket_S3() {}
-  virtual ~RGWHandler_ObjStore_Bucket_S3() {}
+  RGWHandler_REST_Bucket_S3() {}
+  virtual ~RGWHandler_REST_Bucket_S3() {}
 };
 
-class RGWHandler_ObjStore_Obj_S3 : public RGWHandler_ObjStore_S3 {
+class RGWHandler_REST_Obj_S3 : public RGWHandler_REST_S3 {
 protected:
   bool is_acl_op() {
     return s->info.args.exists("acl");
@@ -485,8 +487,8 @@ protected:
   RGWOp *op_post();
   RGWOp *op_options();
 public:
-  RGWHandler_ObjStore_Obj_S3() {}
-  virtual ~RGWHandler_ObjStore_Obj_S3() {}
+  RGWHandler_REST_Obj_S3() {}
+  virtual ~RGWHandler_REST_Obj_S3() {}
 };
 
 class RGWRESTMgr_S3 : public RGWRESTMgr {
@@ -499,9 +501,9 @@ public:
 
   virtual ~RGWRESTMgr_S3() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s);
+  virtual RGWHandler_REST *get_handler(struct req_state *s);
 };
 
-class RGWHandler_ObjStore_Obj_S3Website;
+class RGWHandler_REST_Obj_S3Website;
 
 #endif
index 53449627b43d6744305b5139513d2ba76810eec6..b14942bfd45a289cbb38edb912c348cdb06154f7 100644 (file)
@@ -16,7 +16,7 @@
  
 #include "rgw_rest_s3.h"
 
-class RGWHandler_ObjStore_S3Website : public RGWHandler_ObjStore_S3 {
+class RGWHandler_REST_S3Website : public RGWHandler_REST_S3 {
 protected:
   int retarget(RGWOp *op, RGWOp **new_op);
   // TODO: this should be virtual I think, and ensure that it's always
@@ -34,36 +34,36 @@ protected:
 
   int get_errordoc(const string& errordoc_key, string *error_content);
 public:
-  RGWHandler_ObjStore_S3Website() : RGWHandler_ObjStore_S3() {}
-  virtual ~RGWHandler_ObjStore_S3Website() {}
+  RGWHandler_REST_S3Website() : RGWHandler_REST_S3() {}
+  virtual ~RGWHandler_REST_S3Website() {}
   virtual int error_handler(int err_no, string *error_content);
 };
 
-class RGWHandler_ObjStore_Service_S3Website : public RGWHandler_ObjStore_S3Website {
+class RGWHandler_REST_Service_S3Website : public RGWHandler_REST_S3Website {
 protected:
   virtual RGWOp *get_obj_op(bool get_data);
 public:
-  RGWHandler_ObjStore_Service_S3Website() {}
-  virtual ~RGWHandler_ObjStore_Service_S3Website() {}
+  RGWHandler_REST_Service_S3Website() {}
+  virtual ~RGWHandler_REST_Service_S3Website() {}
 };
 
-class RGWHandler_ObjStore_Obj_S3Website : public RGWHandler_ObjStore_S3Website {
+class RGWHandler_REST_Obj_S3Website : public RGWHandler_REST_S3Website {
 protected:
   virtual RGWOp *get_obj_op(bool get_data);
 public:
-  RGWHandler_ObjStore_Obj_S3Website() {}
-  virtual ~RGWHandler_ObjStore_Obj_S3Website() {}
+  RGWHandler_REST_Obj_S3Website() {}
+  virtual ~RGWHandler_REST_Obj_S3Website() {}
 };
 
 /* The cross-inheritance from Obj to Bucket is deliberate!
  * S3Websites do NOT support any bucket operations
  */
-class RGWHandler_ObjStore_Bucket_S3Website : public RGWHandler_ObjStore_S3Website {
+class RGWHandler_REST_Bucket_S3Website : public RGWHandler_REST_S3Website {
 protected:
   RGWOp *get_obj_op(bool get_data);
 public:
-  RGWHandler_ObjStore_Bucket_S3Website() {}
-  virtual ~RGWHandler_ObjStore_Bucket_S3Website() {}
+  RGWHandler_REST_Bucket_S3Website() {}
+  virtual ~RGWHandler_REST_Bucket_S3Website() {}
 };
 
 // TODO: do we actually need this?
index 539fcd2424c812b8496a2ca93a2d161e3a91881f..e409fd8b157c2c4a7a4ba95613bd1c1ed832fa45 100644 (file)
@@ -1145,17 +1145,17 @@ void RGWBulkDelete_ObjStore_SWIFT::send_response()
   rgw_flush_formatter_and_reset(s, s->formatter);
 }
 
-RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_get()
+RGWOp *RGWHandler_REST_Service_SWIFT::op_get()
 {
   return new RGWListBuckets_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_head()
+RGWOp *RGWHandler_REST_Service_SWIFT::op_head()
 {
   return new RGWStatAccount_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_post()
+RGWOp *RGWHandler_REST_Service_SWIFT::op_post()
 {
   if (s->info.args.exists("bulk-delete")) {
     return new RGWBulkDelete_ObjStore_SWIFT;
@@ -1163,7 +1163,7 @@ RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_post()
   return new RGWPutMetadataAccount_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_delete()
+RGWOp *RGWHandler_REST_Service_SWIFT::op_delete()
 {
   if (s->info.args.exists("bulk-delete")) {
     return new RGWBulkDelete_ObjStore_SWIFT;
@@ -1171,7 +1171,7 @@ RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_delete()
   return NULL;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::get_obj_op(bool get_data)
+RGWOp *RGWHandler_REST_Bucket_SWIFT::get_obj_op(bool get_data)
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_SWIFT;
@@ -1183,7 +1183,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::get_obj_op(bool get_data)
     return new RGWStatBucket_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_get()
+RGWOp *RGWHandler_REST_Bucket_SWIFT::op_get()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_SWIFT;
@@ -1191,7 +1191,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_get()
   return get_obj_op(true);
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_head()
+RGWOp *RGWHandler_REST_Bucket_SWIFT::op_head()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_SWIFT;
@@ -1199,7 +1199,7 @@ RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_head()
   return get_obj_op(false);
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_put()
+RGWOp *RGWHandler_REST_Bucket_SWIFT::op_put()
 {
   if (is_acl_op()) {
     return new RGWPutACLs_ObjStore_SWIFT;
@@ -1207,22 +1207,22 @@ RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_put()
   return new RGWCreateBucket_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_delete()
+RGWOp *RGWHandler_REST_Bucket_SWIFT::op_delete()
 {
   return new RGWDeleteBucket_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_post()
+RGWOp *RGWHandler_REST_Bucket_SWIFT::op_post()
 {
   return new RGWPutMetadataBucket_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Bucket_SWIFT::op_options()
+RGWOp *RGWHandler_REST_Bucket_SWIFT::op_options()
 {
   return new RGWOptionsCORS_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::get_obj_op(bool get_data)
+RGWOp *RGWHandler_REST_Obj_SWIFT::get_obj_op(bool get_data)
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_SWIFT;
@@ -1233,7 +1233,7 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::get_obj_op(bool get_data)
   return get_obj_op;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_get()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_get()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_SWIFT;
@@ -1241,7 +1241,7 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_get()
   return get_obj_op(true);
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_head()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_head()
 {
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_SWIFT;
@@ -1249,7 +1249,7 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_head()
   return get_obj_op(false);
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_put()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_put()
 {
   if (is_acl_op()) {
     return new RGWPutACLs_ObjStore_SWIFT;
@@ -1260,27 +1260,27 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_put()
     return new RGWCopyObj_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_delete()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_delete()
 {
   return new RGWDeleteObj_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_post()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_post()
 {
   return new RGWPutMetadataObject_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_copy()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_copy()
 {
   return new RGWCopyObj_ObjStore_SWIFT;
 }
 
-RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_options()
+RGWOp *RGWHandler_REST_Obj_SWIFT::op_options()
 {
   return new RGWOptionsCORS_ObjStore_SWIFT;
 }
 
-int RGWHandler_ObjStore_SWIFT::authorize()
+int RGWHandler_REST_SWIFT::authorize()
 {
   if ((!s->os_auth_token && s->info.args.get("temp_url_sig").empty()) ||
       (s->op == OP_OPTIONS)) {
@@ -1297,16 +1297,19 @@ int RGWHandler_ObjStore_SWIFT::authorize()
   return 0;
 }
 
-int RGWHandler_ObjStore_SWIFT::postauth_init()
+int RGWHandler_REST_SWIFT::postauth_init()
 {
-  struct req_init_state *t = &s->init_state;
+  struct req_init_statet = &s->init_state;
 
   /* XXX Stub this until Swift Auth sets account into URL. */
   s->bucket_tenant = s->user.user_id.tenant;
   s->bucket_name = t->url_bucket;
 
-  dout(10) << "s->object=" << (!s->object.empty() ? s->object : rgw_obj_key("<NULL>"))
-           << " s->bucket=" << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name) << dendl;
+  dout(10) << "s->object=" <<
+    (!s->object.empty() ? s->object : rgw_obj_key("<NULL>"))
+           << " s->bucket="
+          << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name)
+          << dendl;
 
   int ret;
   ret = validate_tenant_name(s->bucket_tenant);
@@ -1340,9 +1343,9 @@ int RGWHandler_ObjStore_SWIFT::postauth_init()
   return 0;
 }
 
-int RGWHandler_ObjStore_SWIFT::validate_bucket_name(const string& bucket)
+int RGWHandler_REST_SWIFT::validate_bucket_name(const string& bucket)
 {
-  int ret = RGWHandler_ObjStore::validate_bucket_name(bucket);
+  int ret = RGWHandler_REST::validate_bucket_name(bucket);
   if (ret < 0)
     return ret;
 
@@ -1383,7 +1386,7 @@ static void next_tok(string& str, string& tok, char delim)
   }
 }
 
-int RGWHandler_ObjStore_SWIFT::init_from_header(struct req_state *s)
+int RGWHandler_REST_SWIFT::init_from_header(struct req_state *s)
 {
   string req;
   string first;
@@ -1437,7 +1440,8 @@ int RGWHandler_ObjStore_SWIFT::init_from_header(struct req_state *s)
 
   /* verify that the request_uri conforms with what's expected */
   char buf[g_conf->rgw_swift_url_prefix.length() + 16 + tenant_path.length()];
-  int blen = sprintf(buf, "/%s/v1%s", g_conf->rgw_swift_url_prefix.c_str(), tenant_path.c_str());
+  int blen = sprintf(buf, "/%s/v1%s",
+                   g_conf->rgw_swift_url_prefix.c_str(), tenant_path.c_str());
   if (s->decoded_uri[0] != '/' ||
     s->decoded_uri.compare(0, blen, buf) !=  0) {
     return -ENOENT;
@@ -1469,15 +1473,16 @@ int RGWHandler_ObjStore_SWIFT::init_from_header(struct req_state *s)
   s->init_state.url_bucket = first;
 
   if (req.size()) {
-    s->object = rgw_obj_key(req, s->info.env->get("HTTP_X_OBJECT_VERSION_ID", "")); /* rgw swift extension */
+    s->object =
+      rgw_obj_key(req, s->info.env->get("HTTP_X_OBJECT_VERSION_ID", "")); /* rgw swift extension */
     s->info.effective_uri.append("/" + s->object.name);
   }
 
   return 0;
 }
 
-int RGWHandler_ObjStore_SWIFT::init(RGWRados *store, struct req_state *s,
-                                   RGWClientIO *cio)
+int RGWHandler_REST_SWIFT::init(RGWRados* store, struct req_state* s,
+                               RGWClientIO *cio)
 {
   struct req_init_state *t = &s->init_state;
 
@@ -1514,20 +1519,20 @@ int RGWHandler_ObjStore_SWIFT::init(RGWRados *store, struct req_state *s,
     s->op = OP_PUT;
   }
 
-  return RGWHandler_ObjStore::init(store, s, cio);
+  return RGWHandler_REST::init(store, s, cio);
 }
 
-RGWHandler *RGWRESTMgr_SWIFT::get_handler(struct req_state *s)
+RGWHandler_REST* RGWRESTMgr_SWIFT::get_handler(struct req_state *s)
 {
-  int ret = RGWHandler_ObjStore_SWIFT::init_from_header(s);
+  int ret = RGWHandler_REST_SWIFT::init_from_header(s);
   if (ret < 0)
     return NULL;
 
   if (s->init_state.url_bucket.empty())
-    return new RGWHandler_ObjStore_Service_SWIFT;
+    return new RGWHandler_REST_Service_SWIFT;
 
   if (s->object.empty())
-    return new RGWHandler_ObjStore_Bucket_SWIFT;
+    return new RGWHandler_REST_Bucket_SWIFT;
 
-  return new RGWHandler_ObjStore_Obj_SWIFT;
+  return new RGWHandler_REST_Obj_SWIFT;
 }
index 1d483b37cda6d3e7146c7538e930c82cf7805d8b..170f4fe78ba5040917cdac309999cd98a646005c 100644 (file)
@@ -178,7 +178,7 @@ public:
   void send_response();
 };
 
-class RGWHandler_ObjStore_SWIFT : public RGWHandler_ObjStore {
+class RGWHandler_REST_SWIFT : public RGWHandler_REST {
   friend class RGWRESTMgr_SWIFT;
 protected:
   virtual bool is_acl_op() {
@@ -187,8 +187,8 @@ protected:
 
   static int init_from_header(struct req_state *s);
 public:
-  RGWHandler_ObjStore_SWIFT() {}
-  virtual ~RGWHandler_ObjStore_SWIFT() {}
+  RGWHandler_REST_SWIFT() {}
+  virtual ~RGWHandler_REST_SWIFT() {}
 
   int validate_bucket_name(const string& bucket);
 
@@ -200,18 +200,18 @@ public:
   void free_policy(RGWAccessControlPolicy *policy) { delete policy; }
 };
 
-class RGWHandler_ObjStore_Service_SWIFT : public RGWHandler_ObjStore_SWIFT {
+class RGWHandler_REST_Service_SWIFT : public RGWHandler_REST_SWIFT {
 protected:
   RGWOp *op_get();
   RGWOp *op_head();
   RGWOp *op_post();
   RGWOp *op_delete();
 public:
-  RGWHandler_ObjStore_Service_SWIFT() {}
-  virtual ~RGWHandler_ObjStore_Service_SWIFT() {}
+  RGWHandler_REST_Service_SWIFT() {}
+  virtual ~RGWHandler_REST_Service_SWIFT() {}
 };
 
-class RGWHandler_ObjStore_Bucket_SWIFT : public RGWHandler_ObjStore_SWIFT {
+class RGWHandler_REST_Bucket_SWIFT : public RGWHandler_REST_SWIFT {
 protected:
   bool is_obj_update_op() {
     return s->op == OP_POST;
@@ -225,11 +225,11 @@ protected:
   RGWOp *op_post();
   RGWOp *op_options();
 public:
-  RGWHandler_ObjStore_Bucket_SWIFT() {}
-  virtual ~RGWHandler_ObjStore_Bucket_SWIFT() {}
+  RGWHandler_REST_Bucket_SWIFT() {}
+  virtual ~RGWHandler_REST_Bucket_SWIFT() {}
 };
 
-class RGWHandler_ObjStore_Obj_SWIFT : public RGWHandler_ObjStore_SWIFT {
+class RGWHandler_REST_Obj_SWIFT : public RGWHandler_REST_SWIFT {
 protected:
   bool is_obj_update_op() {
     return s->op == OP_POST;
@@ -243,9 +243,10 @@ protected:
   RGWOp *op_post();
   RGWOp *op_copy();
   RGWOp *op_options();
+
 public:
-  RGWHandler_ObjStore_Obj_SWIFT() {}
-  virtual ~RGWHandler_ObjStore_Obj_SWIFT() {}
+  RGWHandler_REST_Obj_SWIFT() {}
+  virtual ~RGWHandler_REST_Obj_SWIFT() {}
 };
 
 class RGWRESTMgr_SWIFT : public RGWRESTMgr {
@@ -253,7 +254,7 @@ public:
   RGWRESTMgr_SWIFT() {}
   virtual ~RGWRESTMgr_SWIFT() {}
 
-  virtual RGWHandler *get_handler(struct req_state *s);
+  virtual RGWHandler_REST *get_handler(struct req_state *s);
 };
 
 #endif
index 1851ddfc3d5f8527a7dd4c45af44ecc261034206..e0963803f07f9464aa95e3a9a56a7711edf5a111 100644 (file)
@@ -26,10 +26,9 @@ public:
   RGWRESTMgr_Usage() {}
   virtual ~RGWRESTMgr_Usage() {}
 
-  RGWHandler *get_handler(struct req_state *s) {
+  RGWHandler_REST* get_handler(struct req_state *s) {
     return new RGWHandler_Usage;
   }
 };
 
-
 #endif
index 4fe22f7366c8b8f4a924c4361781d74d7380e2f0..d3c399bb97a65ae2f293e71017c6f85ed18f1c98 100644 (file)
@@ -28,7 +28,7 @@ public:
   RGWRESTMgr_User() {}
   virtual ~RGWRESTMgr_User() {}
 
-  RGWHandler *get_handler(struct req_state *s) {
+  RGWHandler_REST *get_handler(struct req_state *s) {
     return new RGWHandler_User;
   }
 };
index 6b19d04523d6a6872bfb9dfa0915de0bec7a859d..be835fc068abec4757dcfeab96727a912e0511f7 100644 (file)
@@ -21,7 +21,7 @@ public:
   virtual const string name() { return "swift_auth_get"; }
 };
 
-class RGWHandler_SWIFT_Auth : public RGWHandler {
+class RGWHandler_SWIFT_Auth : public RGWHandler_REST {
 public:
   RGWHandler_SWIFT_Auth() {}
   ~RGWHandler_SWIFT_Auth() {}
@@ -44,7 +44,7 @@ public:
   virtual RGWRESTMgr *get_resource_mgr(struct req_state *s, const string& uri, string *out_uri) {
     return this;
   }
-  virtual RGWHandler *get_handler(struct req_state *s) {
+  virtual RGWHandler_REST* get_handler(struct req_state *s) {
     return new RGWHandler_SWIFT_Auth;
   }
 };