]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: switch to namespaces and change naming in the frontend subsystem.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 4 Oct 2016 11:21:13 +0000 (13:21 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 21 Oct 2016 20:57:21 +0000 (22:57 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
24 files changed:
src/rgw/rgw_asio_client.cc
src/rgw/rgw_asio_client.h
src/rgw/rgw_civetweb.cc
src/rgw/rgw_civetweb.h
src/rgw/rgw_civetweb_frontend.cc
src/rgw/rgw_client_io.cc
src/rgw/rgw_client_io.h
src/rgw/rgw_client_io_decoimpl.h
src/rgw/rgw_common.h
src/rgw/rgw_fcgi.cc
src/rgw/rgw_fcgi.h
src/rgw/rgw_fcgi_process.cc
src/rgw/rgw_lib.h
src/rgw/rgw_loadgen.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h
src/rgw/rgw_swift_auth.cc
src/rgw/rgw_swift_auth.h

index 06627b660c9f8e5be9116600c488000ab8d670ee..577d0027711b28d0325b04b1806b91e2e9e088ee 100644 (file)
@@ -85,7 +85,7 @@ size_t RGWAsioClientIO::write_data(const char* const buf,
   auto bytes = boost::asio::write(socket, boost::asio::buffer(buf, len), ec);
   if (ec) {
     derr << "write_data failed with " << ec.message() << dendl;
-    throw RGWRestfulIOEngine::Exception(ec.value(), std::system_category());
+    throw rgw::io::RestfulClient::Exception(ec.value(), std::system_category());
   }
   return bytes;
 }
index afbfa0fcee9c1cb54e0ff4db92d93c606f1e3bc0..80dfa036390e7d8804c32efc30bafe3be8955057 100644 (file)
@@ -24,7 +24,7 @@ class RGWBufferlistBody {
                                             Headers>;
 };
 
-class RGWAsioClientIO : public RGWRestfulIOEngine {
+class RGWAsioClientIO : public rgw::io::RestfulClient {
   using tcp = boost::asio::ip::tcp;
   tcp::socket socket;
 
index 51873933134299880a7beb976f994d9da1bb19ac..2eb74a8400667c8634bc142059f0a54681f215d1 100644 (file)
@@ -17,9 +17,9 @@ size_t RGWCivetWeb::write_data(const char *buf, size_t len)
   const int ret = mg_write(conn, buf, len);
   if (ret == 0) {
     /* didn't send anything, error out */
-    throw RGWRestfulIOEngine::Exception(EIO, std::system_category());
+    throw rgw::io::RestfulClient::Exception(EIO, std::system_category());
   } else if (ret < 0) {
-    throw RGWRestfulIOEngine::Exception(-ret, std::system_category());
+    throw rgw::io::RestfulClient::Exception(-ret, std::system_category());
   }
   return ret;
 }
@@ -36,7 +36,7 @@ size_t RGWCivetWeb::read_data(char *buf, size_t len)
 {
   const int ret = mg_read(conn, buf, len);
   if (ret < 0) {
-    throw RGWRestfulIOEngine::Exception(-ret, std::system_category());
+    throw rgw::io::RestfulClient::Exception(-ret, std::system_category());
   }
   return ret;
 }
@@ -121,9 +121,9 @@ static inline size_t safe_mg_printf(Args&&... args)
   const int ret = mg_printf(std::forward<Args>(args)...);
   if (ret == 0) {
     /* didn't send anything, error out */
-    throw RGWRestfulIOEngine::Exception(EIO, std::system_category());
+    throw rgw::io::RestfulClient::Exception(EIO, std::system_category());
   } else if (ret < 0) {
-    throw RGWRestfulIOEngine::Exception(-ret, std::system_category());
+    throw rgw::io::RestfulClient::Exception(-ret, std::system_category());
   }
   return static_cast<size_t>(ret);
 }
index 5f91e311965c2c95b1a1992101bec87993d6d3fb..d353a8c152deeab885bd3b9274639cd857229bbb 100644 (file)
@@ -10,7 +10,7 @@
 
 struct mg_connection;
 
-class RGWCivetWeb : public RGWRestfulIOEngine
+class RGWCivetWeb : public rgw::io::RestfulClient
 {
   RGWEnv env;
   mg_connection *conn;
index 802294264128108677efc4c2614956c6a77a5751..cda10f027fbe580965b9b617a5adf5c6170bc817 100644 (file)
@@ -23,10 +23,10 @@ int RGWCivetWebFrontend::process(struct mg_connection*  const conn)
   RWLock::RLocker lock(env.mutex);
 
   RGWRequest req(env.store->get_new_req_id());
-  auto real_client_io = rgw_restful_io_add_reordering(
-                          rgw_restful_io_add_buffering(
-                            rgw_restful_io_add_chunking(
-                              rgw_restful_io_add_conlen_controlling(
+  auto real_client_io = rgw::io::add_reordering(
+                          rgw::io::add_buffering(
+                            rgw::io::add_chunking(
+                              rgw::io::add_conlen_controlling(
                                 RGWCivetWeb(conn, env.port)))));
   RGWRestfulIO client_io(&real_client_io);
 
index 9c572a96c76b80f3950df8b811b40b7fcd2f32aa..a01a357e1bbe423740bf309294cfc4ca198daad8 100644 (file)
@@ -9,7 +9,10 @@
 
 #define dout_subsys ceph_subsys_rgw
 
-void RGWClientIO::init(CephContext *cct) {
+namespace rgw {
+namespace io {
+
+void BasicClient::init(CephContext *cct) {
   init_env(cct);
 
   if (cct->_conf->subsys.should_gather(ceph_subsys_rgw, 20)) {
@@ -22,6 +25,8 @@ void RGWClientIO::init(CephContext *cct) {
   }
 }
 
+} /* namespace io */
+} /* namespace rgw */
 
 int RGWRestfulIO::recv_body(char *buf, size_t max, bool calculate_hash)
 {
@@ -35,7 +40,7 @@ int RGWRestfulIO::recv_body(char *buf, size_t max, bool calculate_hash)
       calc_hash_sha256_update_stream(sha256_hash, buf, sent);
     }
     return sent;
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     return -e.code().value();
   }
 }
index 61de21dbcab2f407573cb770c98e417f22fa814b..46e2da118b61ae949aa5136d923e0347b0d38623 100644 (file)
 #include "include/types.h"
 #include "rgw_common.h"
 
-class RGWClientIO {
+namespace rgw {
+namespace io {
+
+class BasicClient {
 protected:
   virtual void init_env(CephContext *cct) = 0;
 
 public:
-  virtual ~RGWClientIO() {}
+  virtual ~BasicClient() {}
 
   void init(CephContext *cct);
   virtual RGWEnv& get_env() noexcept = 0;
   virtual int complete_request() = 0;
-}; /* RGWClient IO */
+}; /* rgw::io::Client */
 
 
-class RGWClientIOAccounter {
+class Accounter {
 public:
-  virtual ~RGWClientIOAccounter() {}
+  virtual ~Accounter() {}
 
   virtual void set_account(bool enabled) = 0;
 
   virtual uint64_t get_bytes_sent() const = 0;
   virtual uint64_t get_bytes_received() const = 0;
-};
+}; /* rgw::io::Accounter */
 
 
-class RGWRestfulIOEngine : public RGWClientIO {
-  template<typename T> friend class RGWDecoratedRestfulIO;
+class RestfulClient : public BasicClient {
+  template<typename T> friend class DecoratedRestfulClient;
 
 public:
   typedef std::system_error Exception;
@@ -84,15 +87,15 @@ public:
 };
 
 
-/* Abstract decorator over any implementation of RGWRestfulIOEngine. */
+/* Abstract decorator over any implementation of rgw::io::RestfulClient. */
 template <typename DecorateeT>
-class RGWDecoratedRestfulIO : public RGWRestfulIOEngine {
-  template<typename T> friend class RGWDecoratedRestfulIO;
+class DecoratedRestfulClient : public RestfulClient {
+  template<typename T> friend class DecoratedRestfulClient;
 
   typedef typename std::remove_pointer<DecorateeT>::type DerefedDecorateeT;
 
-  static_assert(std::is_base_of<RGWRestfulIOEngine, DerefedDecorateeT>::value,
-                "DecorateeT must be a subclass of RGWRestfulIOEngine");
+  static_assert(std::is_base_of<RestfulClient, DerefedDecorateeT>::value,
+                "DecorateeT must be a subclass of rgw::io::RestfulClient");
 
   DecorateeT decoratee;
 
@@ -120,7 +123,7 @@ protected:
   }
 
 public:
-  RGWDecoratedRestfulIO(DecorateeT&& decoratee)
+  DecoratedRestfulClient(DecorateeT&& decoratee)
     : decoratee(std::move(decoratee)) {
   }
 
@@ -172,6 +175,9 @@ public:
   }
 };
 
+} /* namespace rgw */
+} /* namespace io */
+
 
 /* We're doing this nasty thing only because of extensive usage of templates
  * to implement the static decorator pattern. C++ templates de facto enforce
@@ -182,23 +188,23 @@ public:
 
 
 /* RGWRestfulIO: high level interface to interact with RESTful clients. What
- * differentiates it from RGWRestfulIOEngine is providing more specific APIs
- * like RGWClientIOAccounter or the AWS Auth v4 stuff implemented by filters
+ * differentiates it from rgw::io::RestfulClient is providing more specific APIs
+ * like rgw::io::Accounter or the AWS Auth v4 stuff implemented by filters
  * while hiding the pipelined architecture from clients.
  *
- * RGWClientIOAccounter came in as a part of RGWRestfulIOAccountingEngine. */
-class RGWRestfulIO : public RGWRestfulIOAccountingEngine<RGWRestfulIOEngine*> {
+ * rgw::io::Accounter came in as a part of rgw::io::AccountingFilter. */
+class RGWRestfulIO : public rgw::io::AccountingFilter<rgw::io::RestfulClient*> {
   SHA256 *sha256_hash;
 
 public:
   virtual ~RGWRestfulIO() {}
 
-  RGWRestfulIO(RGWRestfulIOEngine* engine)
-    : RGWRestfulIOAccountingEngine<RGWRestfulIOEngine*>(std::move(engine)),
+  RGWRestfulIO(rgw::io::RestfulClient* engine)
+    : AccountingFilter<rgw::io::RestfulClient*>(std::move(engine)),
       sha256_hash(nullptr) {
   }
 
-  using RGWDecoratedRestfulIO<RGWRestfulIOEngine*>::recv_body;
+  using DecoratedRestfulClient<RestfulClient*>::recv_body;
   virtual int recv_body(char* buf, size_t max, bool calculate_hash);
   std::string grab_aws4_sha256_hash();
 }; /* RGWRestfulIO */
@@ -210,8 +216,8 @@ static inline RGWRestfulIO* RESTFUL_IO(struct req_state* s) {
   return static_cast<RGWRestfulIO*>(s->cio);
 }
 
-static inline RGWClientIOAccounter* ACCOUNTING_IO(struct req_state* s) {
-  return dynamic_cast<RGWClientIOAccounter*>(s->cio);
+static inline rgw::io::Accounter* ACCOUNTING_IO(struct req_state* s) {
+  return dynamic_cast<rgw::io::Accounter*>(s->cio);
 }
 
 
index cfecacfc8df0cda1258dce6d8e58b498ed6c1b6c..5847c5b4c24b49438bb78e0ebd1e900fe17b7c5c 100644 (file)
 #include "rgw_common.h"
 #include "rgw_client_io.h"
 
+namespace rgw {
+namespace io {
+
 template <typename T>
-class RGWRestfulIOAccountingEngine : public RGWDecoratedRestfulIO<T>,
-                                     public RGWClientIOAccounter {
+class AccountingFilter : public DecoratedRestfulClient<T>,
+                         public Accounter {
   bool enabled;
   uint64_t total_sent;
   uint64_t total_received;
 
 public:
   template <typename U>
-  RGWRestfulIOAccountingEngine(U&& decoratee)
-    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
+  AccountingFilter(U&& decoratee)
+    : DecoratedRestfulClient<T>(std::move(decoratee)),
       enabled(false),
       total_sent(0),
       total_received(0) {
@@ -29,7 +32,8 @@ public:
 
   size_t send_status(const int status,
                      const char* const status_name) override {
-    const auto sent = RGWDecoratedRestfulIO<T>::send_status(status, status_name);
+    const auto sent = DecoratedRestfulClient<T>::send_status(status,
+                                                             status_name);
     if (enabled) {
       total_sent += sent;
     }
@@ -37,7 +41,7 @@ public:
   }
 
   size_t send_100_continue() override {
-    const auto sent = RGWDecoratedRestfulIO<T>::send_100_continue();
+    const auto sent = DecoratedRestfulClient<T>::send_100_continue();
     if (enabled) {
       total_sent += sent;
     }
@@ -46,7 +50,7 @@ public:
 
   size_t send_header(const boost::string_ref& name,
                      const boost::string_ref& value) override {
-    const auto sent = RGWDecoratedRestfulIO<T>::send_header(name, value);
+    const auto sent = DecoratedRestfulClient<T>::send_header(name, value);
     if (enabled) {
       total_sent += sent;
     }
@@ -54,7 +58,7 @@ public:
   }
 
   size_t send_content_length(const uint64_t len) override {
-    const auto sent = RGWDecoratedRestfulIO<T>::send_content_length(len);
+    const auto sent = DecoratedRestfulClient<T>::send_content_length(len);
     if (enabled) {
       total_sent += sent;
     }
@@ -62,7 +66,7 @@ public:
   }
 
   size_t send_chunked_transfer_encoding() override {
-    const auto sent = RGWDecoratedRestfulIO<T>::send_chunked_transfer_encoding();
+    const auto sent = DecoratedRestfulClient<T>::send_chunked_transfer_encoding();
     if (enabled) {
       total_sent += sent;
     }
@@ -70,7 +74,7 @@ public:
   }
 
   size_t complete_header() override {
-    const auto sent = RGWDecoratedRestfulIO<T>::complete_header();
+    const auto sent = DecoratedRestfulClient<T>::complete_header();
     if (enabled) {
       total_sent += sent;
     }
@@ -78,7 +82,7 @@ public:
   }
 
   size_t recv_body(char* buf, size_t max) override {
-    const auto received = RGWDecoratedRestfulIO<T>::recv_body(buf, max);
+    const auto received = DecoratedRestfulClient<T>::recv_body(buf, max);
     if (enabled) {
       total_received += received;
     }
@@ -87,7 +91,7 @@ public:
 
   size_t send_body(const char* const buf,
                    const size_t len) override {
-    const auto sent = RGWDecoratedRestfulIO<T>::send_body(buf, len);
+    const auto sent = DecoratedRestfulClient<T>::send_body(buf, len);
     if (enabled) {
       total_sent += sent;
     }
@@ -111,8 +115,8 @@ public:
 /* Filter for in-memory buffering incoming data and calculating the content
  * length header if it isn't present. */
 template <typename T>
-class RGWRestfulIOBufferingEngine : public RGWDecoratedRestfulIO<T> {
-  template<typename Td> friend class RGWDecoratedRestfulIO;
+class BufferingFilter : public DecoratedRestfulClient<T> {
+  template<typename Td> friend class DecoratedRestfulClient;
 protected:
   ceph::bufferlist data;
 
@@ -121,8 +125,8 @@ protected:
 
 public:
   template <typename U>
-  RGWRestfulIOBufferingEngine(U&& decoratee)
-    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
+  BufferingFilter(U&& decoratee)
+    : DecoratedRestfulClient<T>(std::move(decoratee)),
       has_content_length(false),
       buffer_data(false) {
   }
@@ -135,33 +139,33 @@ public:
 };
 
 template <typename T>
-size_t RGWRestfulIOBufferingEngine<T>::send_body(const char* const buf,
-                                                 const size_t len)
+size_t BufferingFilter<T>::send_body(const char* const buf,
+                                     const size_t len)
 {
   if (buffer_data) {
     data.append(buf, len);
     return 0;
   }
 
-  return RGWDecoratedRestfulIO<T>::send_body(buf, len);
+  return DecoratedRestfulClient<T>::send_body(buf, len);
 }
 
 template <typename T>
-size_t RGWRestfulIOBufferingEngine<T>::send_content_length(const uint64_t len)
+size_t BufferingFilter<T>::send_content_length(const uint64_t len)
 {
   has_content_length = true;
-  return RGWDecoratedRestfulIO<T>::send_content_length(len);
+  return DecoratedRestfulClient<T>::send_content_length(len);
 }
 
 template <typename T>
-size_t RGWRestfulIOBufferingEngine<T>::send_chunked_transfer_encoding()
+size_t BufferingFilter<T>::send_chunked_transfer_encoding()
 {
   has_content_length = true;
-  return RGWDecoratedRestfulIO<T>::send_chunked_transfer_encoding();
+  return DecoratedRestfulClient<T>::send_chunked_transfer_encoding();
 }
 
 template <typename T>
-size_t RGWRestfulIOBufferingEngine<T>::complete_header()
+size_t BufferingFilter<T>::complete_header()
 {
   if (! has_content_length) {
     /* We will dump everything in complete_request(). */
@@ -169,79 +173,80 @@ size_t RGWRestfulIOBufferingEngine<T>::complete_header()
     return 0;
   }
 
-  return RGWDecoratedRestfulIO<T>::complete_header();
+  return DecoratedRestfulClient<T>::complete_header();
 }
 
 template <typename T>
-int RGWRestfulIOBufferingEngine<T>::complete_request()
+int BufferingFilter<T>::complete_request()
 {
   size_t sent = 0;
 
   if (! has_content_length) {
-    sent += RGWDecoratedRestfulIO<T>::send_content_length(data.length());
-    sent += RGWDecoratedRestfulIO<T>::complete_header();
+    sent += DecoratedRestfulClient<T>::send_content_length(data.length());
+    sent += DecoratedRestfulClient<T>::complete_header();
   }
 
   if (buffer_data) {
     /* We are sending each buffer separately to avoid extra memory shuffling
      * that would occur on data.c_str() to provide a continuous memory area. */
     for (const auto& ptr : data.buffers()) {
-      sent += RGWDecoratedRestfulIO<T>::send_body(ptr.c_str(),
-                                                  ptr.length());
+      sent += DecoratedRestfulClient<T>::send_body(ptr.c_str(),
+                                                   ptr.length());
     }
     data.clear();
     buffer_data = false;
   }
 
-  return sent + RGWDecoratedRestfulIO<T>::complete_request();
+  return sent + DecoratedRestfulClient<T>::complete_request();
 }
 
 template <typename T> static inline
-RGWRestfulIOBufferingEngine<T> rgw_restful_io_add_buffering(T&& t) {
-  return RGWRestfulIOBufferingEngine<T>(std::move(t));
+BufferingFilter<T> add_buffering(T&& t) {
+  return BufferingFilter<T>(std::move(t));
 }
 
 
 template <typename T>
-class RGWRestfulIOChunkingEngine : public RGWDecoratedRestfulIO<T> {
-  template<typename Td> friend class RGWDecoratedRestfulIO;
+class ChunkingFilter : public DecoratedRestfulClient<T> {
+  template<typename Td> friend class DecoratedRestfulClient;
 protected:
   bool has_content_length;
   bool chunking_enabled;
 
 public:
   template <typename U>
-  RGWRestfulIOChunkingEngine(U&& decoratee)
-    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
+  ChunkingFilter(U&& decoratee)
+    : DecoratedRestfulClient<T>(std::move(decoratee)),
       has_content_length(false),
       chunking_enabled(false) {
   }
 
   size_t send_content_length(const uint64_t len) override {
     has_content_length = true;
-    return RGWDecoratedRestfulIO<T>::send_content_length(len);
+    return DecoratedRestfulClient<T>::send_content_length(len);
   }
 
   size_t send_chunked_transfer_encoding() override {
     has_content_length = false;
     chunking_enabled = true;
-    return RGWDecoratedRestfulIO<T>::send_header("Transfer-Encoding", "chunked");
+    return DecoratedRestfulClient<T>::send_header("Transfer-Encoding",
+                                                  "chunked");
   }
 
   size_t send_body(const char* buf,
                    const size_t len) override {
     if (! chunking_enabled) {
-      return RGWDecoratedRestfulIO<T>::send_body(buf, len);
+      return DecoratedRestfulClient<T>::send_body(buf, len);
     } else {
       static constexpr char HEADER_END[] = "\r\n";
       char sizebuf[32];
       const auto slen = snprintf(sizebuf, sizeof(buf), "%" PRIx64 "\r\n", len);
       size_t sent = 0;
 
-      sent += RGWDecoratedRestfulIO<T>::send_body(sizebuf, slen);
-      sent += RGWDecoratedRestfulIO<T>::send_body(buf, len);
-      sent += RGWDecoratedRestfulIO<T>::send_body(HEADER_END,
-                                                  sizeof(HEADER_END) - 1);
+      sent += DecoratedRestfulClient<T>::send_body(sizebuf, slen);
+      sent += DecoratedRestfulClient<T>::send_body(buf, len);
+      sent += DecoratedRestfulClient<T>::send_body(HEADER_END,
+                                                   sizeof(HEADER_END) - 1);
       return sent;
     }
   }
@@ -251,17 +256,17 @@ public:
 
     if (chunking_enabled) {
       static constexpr char CHUNKED_RESP_END[] = "0\r\n\r\n";
-      sent += RGWDecoratedRestfulIO<T>::send_body(CHUNKED_RESP_END,
-                                                  sizeof(CHUNKED_RESP_END) - 1);
+      sent += DecoratedRestfulClient<T>::send_body(CHUNKED_RESP_END,
+                                                   sizeof(CHUNKED_RESP_END) - 1);
     }
 
-    return sent + RGWDecoratedRestfulIO<T>::complete_request();
+    return sent + DecoratedRestfulClient<T>::complete_request();
   }
 };
 
 template <typename T> static inline
-RGWRestfulIOChunkingEngine<T> rgw_restful_io_add_chunking(T&& t) {
-  return RGWRestfulIOChunkingEngine<T>(std::move(t));
+ChunkingFilter<T> add_chunking(T&& t) {
+  return ChunkingFilter<T>(std::move(t));
 }
 
 
@@ -269,7 +274,7 @@ RGWRestfulIOChunkingEngine<T> rgw_restful_io_add_chunking(T&& t) {
  * header where RFC 7230 requests so. The cases worth our attention are 204 No
  * Content as well as 304 Not Modified. */
 template <typename T>
-class RGWRestfulIOConLenControllingEngine : public RGWDecoratedRestfulIO<T> {
+class ConLenControllingFilter : public DecoratedRestfulClient<T> {
 protected:
   enum class ContentLengthAction {
     FORWARD,
@@ -279,8 +284,8 @@ protected:
 
 public:
   template <typename U>
-  RGWRestfulIOConLenControllingEngine(U&& decoratee)
-    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
+  ConLenControllingFilter(U&& decoratee)
+    : DecoratedRestfulClient<T>(std::move(decoratee)),
       action(ContentLengthAction::UNKNOWN) {
   }
 
@@ -292,13 +297,13 @@ public:
       action = ContentLengthAction::FORWARD;
     }
 
-    return RGWDecoratedRestfulIO<T>::send_status(status, status_name);
+    return DecoratedRestfulClient<T>::send_status(status, status_name);
   }
 
   size_t send_content_length(const uint64_t len) override {
     switch(action) {
     case ContentLengthAction::FORWARD:
-      return RGWDecoratedRestfulIO<T>::send_content_length(len);
+      return DecoratedRestfulClient<T>::send_content_length(len);
     case ContentLengthAction::INHIBIT:
       return 0;
     case ContentLengthAction::UNKNOWN:
@@ -309,15 +314,15 @@ public:
 };
 
 template <typename T> static inline
-RGWRestfulIOConLenControllingEngine<T> rgw_restful_io_add_conlen_controlling(T&& t) {
-  return RGWRestfulIOConLenControllingEngine<T>(std::move(t));
+ConLenControllingFilter<T> add_conlen_controlling(T&& t) {
+  return ConLenControllingFilter<T>(std::move(t));
 }
 
 
 /* Filter that rectifies the wrong behaviour of some clients of the RGWRestfulIO
  * interface. Should be removed after fixing those clients. */
 template <typename T>
-class RGWRestfulIOReorderingEngine : public RGWDecoratedRestfulIO<T> {
+class ReorderingFilter : public DecoratedRestfulClient<T> {
 protected:
   enum class ReorderState {
     RGW_EARLY_HEADERS,  /* Got headers sent before calling send_status. */
@@ -338,7 +343,7 @@ protected:
                                           value.to_string()));
       return 0;
     case ReorderState::RGW_DATA:
-      return RGWDecoratedRestfulIO<T>::send_header(name, value);
+      return DecoratedRestfulClient<T>::send_header(name, value);
     }
 
     return -EIO;
@@ -346,8 +351,8 @@ protected:
 
 public:
   template <typename U>
-  RGWRestfulIOReorderingEngine(U&& decoratee)
-    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
+  ReorderingFilter(U&& decoratee)
+    : DecoratedRestfulClient<T>(std::move(decoratee)),
       phase(ReorderState::RGW_EARLY_HEADERS) {
   }
 
@@ -355,7 +360,7 @@ public:
                      const char* const status_name) override {
     phase = ReorderState::RGW_STATUS_SEEN;
 
-    return RGWDecoratedRestfulIO<T>::send_status(status, status_name);
+    return DecoratedRestfulClient<T>::send_status(status, status_name);
   }
 
   size_t send_content_length(const uint64_t len) override {
@@ -364,7 +369,7 @@ public:
       content_length = len;
       return 0;
     } else {
-      return RGWDecoratedRestfulIO<T>::send_content_length(len);
+      return DecoratedRestfulClient<T>::send_content_length(len);
     }
   }
 
@@ -376,22 +381,24 @@ public:
 
     /* Sent content length if necessary. */
     if (content_length) {
-      sent += RGWDecoratedRestfulIO<T>::send_content_length(*content_length);
+      sent += DecoratedRestfulClient<T>::send_content_length(*content_length);
     }
 
     /* Header data in buffers are already counted. */
     for (const auto& kv : headers) {
-      sent += RGWDecoratedRestfulIO<T>::send_header(kv.first, kv.second);
+      sent += DecoratedRestfulClient<T>::send_header(kv.first, kv.second);
     }
     headers.clear();
 
-    return sent + RGWDecoratedRestfulIO<T>::complete_header();
+    return sent + DecoratedRestfulClient<T>::complete_header();
   }
 };
 
 template <typename T> static inline
-RGWRestfulIOReorderingEngine<T> rgw_restful_io_add_reordering(T&& t) {
-  return RGWRestfulIOReorderingEngine<T>(std::move(t));
+ReorderingFilter<T> add_reordering(T&& t) {
+  return ReorderingFilter<T>(std::move(t));
 }
 
+} /* namespace io */
+} /* namespace rgw */
 #endif /* CEPH_RGW_CLIENT_IO_DECOIMPL_H */
index 28e6396e0d7d0f33496d9eda9c26f1bc33da7aaa..1c486028fd506dd655fb6299aa2544e9bdd17764 100644 (file)
@@ -1131,7 +1131,11 @@ struct req_state;
 
 class RGWEnv;
 
-class RGWClientIO;
+namespace rgw {
+namespace io {
+class BasicClient;
+}
+}
 
 struct req_info {
   RGWEnv *env;
@@ -1265,7 +1269,7 @@ class RGWRequest;
 /** Store all the state necessary to complete and respond to an HTTP request*/
 struct req_state {
   CephContext *cct;
-  RGWClientIO *cio;
+  rgw::io::BasicClient *cio;
   RGWRequest *req; /// XXX: re-remove??
   http_op op;
   RGWOpType op_type;
index de090be4c6b3de9e95af51aab3f67dbe17c1a1a2..54e842d49f30625d5af2c09c39254a09954187fa 100644 (file)
@@ -8,7 +8,7 @@ size_t RGWFCGX::write_data(const char* const buf, const size_t len)
 {
   const auto ret = FCGX_PutStr(buf, len, fcgx->out);
   if (ret < 0) {
-    throw RGWRestfulIOEngine::Exception(-ret, std::system_category());
+    throw rgw::io::RestfulClient::Exception(-ret, std::system_category());
   }
   return ret;
 }
@@ -17,7 +17,7 @@ size_t RGWFCGX::read_data(char* const buf, const size_t len)
 {
   const auto ret = FCGX_GetStr(buf, len, fcgx->in);
   if (ret < 0) {
-    throw RGWRestfulIOEngine::Exception(-ret, std::system_category());
+    throw rgw::io::RestfulClient::Exception(-ret, std::system_category());
   }
   return ret;
 }
index 2fb0582ab444b1b8b6493c0970b62366871175b9..952bb0a8eb21dbbecc33e4e3ad9f7f1342139c6d 100644 (file)
@@ -11,7 +11,7 @@
 
 struct FCGX_Request;
 
-class RGWFCGX : public RGWRestfulIOEngine
+class RGWFCGX : public rgw::io::RestfulClient
 {
   FCGX_Request *fcgx;
   RGWEnv env;
index 554cf2c64a832e21113dad0b3ba827ffb5486912..0f70b561742f15daed216e57ad149963431a1779 100644 (file)
@@ -116,7 +116,7 @@ void RGWFCGXProcess::handle_request(RGWRequest* r)
 {
   RGWFCGXRequest* req = static_cast<RGWFCGXRequest*>(r);
   FCGX_Request* fcgx = req->fcgx;
-  auto real_client_io = rgw_restful_io_add_conlen_controlling(
+  auto real_client_io = rgw::io::add_conlen_controlling(
                           RGWFCGX(fcgx));
   RGWRestfulIO client_io(&real_client_io);
 
index c10f66915c5959d45e2554180064bac3c961ae57..a730822308b6f4a866c41e70f9a1776d784cbca3 100644 (file)
@@ -50,8 +50,8 @@ namespace rgw {
 
 /* request interface */
 
-  class RGWLibIO : public RGWClientIO,
-                   public RGWClientIOAccounter
+  class RGWLibIO : public rgw::io::BasicClient,
+                   public rgw::io::Accounter
   {
     RGWUserInfo user_info;
     RGWEnv env;
index 862fe270bc00f5ca92c41287bd1a2e6ce167358c..a5faf282309fa648a7ffb55866149137f477e967 100644 (file)
@@ -32,7 +32,7 @@ struct RGWLoadGenRequestEnv {
 
 /* XXX does RGWLoadGenIO actually want to perform stream/HTTP I/O,
  * or (e.g) are these NOOPs? */
-class RGWLoadGenIO : public RGWRestfulIOEngine
+class RGWLoadGenIO : public rgw::io::RestfulClient
 {
   uint64_t left_to_read;
   RGWLoadGenRequestEnv* req;
index a6f22b2f9fc0d0ecbd1d07372607b829df7c8127..17b5c905dae7067c6fa6ef32e711d2633e6ad55f 100644 (file)
@@ -5284,7 +5284,9 @@ RGWHandler::~RGWHandler()
 {
 }
 
-int RGWHandler::init(RGWRados *_store, struct req_state *_s, RGWClientIO *cio)
+int RGWHandler::init(RGWRados *_store,
+                     struct req_state *_s,
+                     rgw::io::BasicClient *cio)
 {
   store = _store;
   s = _s;
index 442f530e4ae8dbf9774d0e76b0d510d4a4856b8c..f47edf417fc2dd0b4c7124a186cfca8e01d0e8c5 100644 (file)
@@ -1515,7 +1515,7 @@ public:
   RGWHandler() : store(NULL), s(NULL) {}
   virtual ~RGWHandler();
 
-  virtual int init(RGWRados* store, struct req_state* _s, RGWClientIO* cio);
+  virtual int init(RGWRados* store, struct req_state* _s, rgw::io::BasicClient* cio);
 
   virtual int init_permissions(RGWOp *op) {
     return 0;
index 1ee068429ccb65eccf06b2d7b4e62233b417c475..9e49eb072ace7235b3e784969388421d6a32d9ce 100644 (file)
@@ -281,7 +281,7 @@ static void dump_status(struct req_state *s, int status,
   s->formatter->set_status(status, status_name);
   try {
     RESTFUL_IO(s)->send_status(status, status_name);
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_status() returned err="
                      << e.what() << dendl;
   }
@@ -376,7 +376,7 @@ void dump_header(struct req_state* const s,
 {
   try {
     RESTFUL_IO(s)->send_header(name, val);
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_header() returned err="
                      << e.what() << dendl;
   }
@@ -415,7 +415,7 @@ void dump_content_length(struct req_state* const s, const uint64_t len)
 {
   try {
     RESTFUL_IO(s)->send_content_length(len);
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_content_length() returned err="
                      << e.what() << dendl;
   }
@@ -426,7 +426,7 @@ static void dump_chunked_encoding(struct req_state* const s)
 {
   try {
     RESTFUL_IO(s)->send_chunked_transfer_encoding();
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->send_chunked_transfer_encoding()"
                      << " returned err=" << e.what() << dendl;
   }
@@ -708,7 +708,7 @@ void end_header(struct req_state* s, RGWOp* op, const char *content_type,
 
   try {
     RESTFUL_IO(s)->complete_header();
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->complete_header() returned err="
                     << e.what() << dendl;
   }
@@ -798,7 +798,7 @@ void dump_continue(struct req_state * const s)
 {
   try {
     RESTFUL_IO(s)->send_100_continue();
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->send_100_continue() returned err="
                     << e.what() << dendl;
   }
@@ -834,7 +834,7 @@ int dump_body(struct req_state* const s,
 {
   try {
     return RESTFUL_IO(s)->send_body(buf, len);
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     return -e.code().value();
   }
 }
@@ -855,7 +855,7 @@ int recv_body(struct req_state* const s,
 {
   try {
     return RESTFUL_IO(s)->recv_body(buf, max, s->aws4_auth_needs_complete);
-  } catch (RGWRestfulIOEngine::Exception& e) {
+  } catch (rgw::io::RestfulClient::Exception& e) {
     return -e.code().value();
   }
 }
@@ -1797,7 +1797,7 @@ static int64_t parse_content_length(const char *content_length)
   return len;
 }
 
-int RGWREST::preprocess(struct req_state *s, RGWClientIO* cio)
+int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio)
 {
   req_info& info = s->info;
 
index 95766eb3a9a2a7cbe7f02df29a52e09de513ea99..32c7fdbee408c2d460af9c0b36f87c3cb6497e51 100644 (file)
@@ -477,7 +477,7 @@ class RGWRestfulIO;
 class RGWREST {
   RGWRESTMgr mgr;
 
-  static int preprocess(struct req_state *s, RGWClientIO *rio);
+  static int preprocess(struct req_state *s, rgw::io::BasicClient* rio);
 public:
   RGWREST() {}
   RGWHandler_REST *get_handler(RGWRados *store,
index bf0f916138feab898c5946c24edd9daece9bad33..7f4f3c22d2cf0ca729549e736477830fd3f4e6ed 100644 (file)
@@ -3186,7 +3186,7 @@ int RGWHandler_REST_S3::postauth_init()
 }
 
 int RGWHandler_REST_S3::init(RGWRados *store, struct req_state *s,
-                           RGWClientIO *cio)
+                             rgw::io::BasicClient *cio)
 {
   int ret;
 
@@ -4135,7 +4135,7 @@ int RGW_Auth_S3::authorize_v2(RGWRados *store, struct req_state *s)
 }
 
 int RGWHandler_Auth_S3::init(RGWRados *store, struct req_state *state,
-                            RGWClientIO *cio)
+                             rgw::io::BasicClient *cio)
 {
   int ret = RGWHandler_REST_S3::init_from_header(state, RGW_FORMAT_JSON,
                                                     true);
index c75cf4fdf5354f9edfde7bcdcdebb5e134000015..6793f5fdaf7d8d887881b69d9f826ce9e8f63f86 100644 (file)
@@ -470,7 +470,9 @@ public:
   static int validate_bucket_name(const string& bucket);
   static int validate_object_name(const string& bucket);
 
-  virtual int init(RGWRados *store, struct req_state *s, RGWClientIO *cio);
+  virtual int init(RGWRados *store,
+                   struct req_state *s,
+                   rgw::io::BasicClient *cio);
   virtual int authorize() {
     return RGW_Auth_S3::authorize(store, s);
   }
@@ -485,7 +487,9 @@ public:
   RGWHandler_REST_S3() : RGWHandler_REST() {}
   virtual ~RGWHandler_REST_S3() {}
 
-  virtual int init(RGWRados *store, struct req_state *s, RGWClientIO *cio);
+  virtual int init(RGWRados *store,
+                   struct req_state *s,
+                   rgw::io::BasicClient *cio);
   virtual int authorize() {
     return RGW_Auth_S3::authorize(store, s);
   }
index 17bb13de5934a297ff979aefae2662b0c91f1673..64995b1fcc3f09fc5231f626e8e89579104a6ee2 100644 (file)
@@ -2347,7 +2347,7 @@ int RGWHandler_REST_SWIFT::init_from_header(struct req_state *s)
 }
 
 int RGWHandler_REST_SWIFT::init(RGWRados* store, struct req_state* s,
-                               RGWClientIO *cio)
+                               rgw::io::BasicClient *cio)
 {
   struct req_init_state *t = &s->init_state;
 
index f318f9b0119b29c66dc5b1a8d1c0ebf1101f81ee..4cc68ef6a07fbdbeb9fc3a418e4109bedc698a9a 100644 (file)
@@ -266,7 +266,7 @@ public:
 
   static int validate_bucket_name(const string& bucket);
 
-  int init(RGWRados *store, struct req_state *s, RGWClientIO *cio);
+  int init(RGWRados *store, struct req_state *s, rgw::io::BasicClient *cio);
   int authorize() override;
   int postauth_init() override;
 
@@ -315,7 +315,7 @@ public:
 
   int init(RGWRados* const store,
            struct req_state* const s,
-           RGWClientIO* const cio) override {
+           rgw::io::BasicClient* const cio) override {
     website_handler = boost::in_place<RGWSwiftWebsiteHandler>(store, s, this);
     return RGWHandler_REST_SWIFT::init(store, s, cio);
   }
@@ -353,7 +353,7 @@ public:
 
   int init(RGWRados* const store,
            struct req_state* const s,
-           RGWClientIO* const cio) override {
+           rgw::io::BasicClient* const cio) override {
     website_handler = boost::in_place<RGWSwiftWebsiteHandler>(store, s, this);
     return RGWHandler_REST_SWIFT::init(store, s, cio);
   }
@@ -403,7 +403,7 @@ public:
 
   int init(RGWRados* const store,
            struct req_state* const state,
-           RGWClientIO* const cio) override {
+           rgw::io::BasicClient* const cio) override {
     state->dialect = "swift";
     state->formatter = new JSONFormatter;
     state->format = RGW_FORMAT_JSON;
@@ -456,7 +456,7 @@ public:
 
   int init(RGWRados* const store,
            struct req_state* const state,
-           RGWClientIO* const cio) override {
+           rgw::io::BasicClient* const cio) override {
     state->dialect = "swift";
     state->formatter = new JSONFormatter;
     state->format = RGW_FORMAT_JSON;
@@ -509,7 +509,7 @@ public:
 
   int init(RGWRados* const store,
            struct req_state* const state,
-           RGWClientIO* const cio) override {
+           rgw::io::BasicClient* const cio) override {
     state->dialect = "swift";
     state->formatter = new JSONFormatter;
     state->format = RGW_FORMAT_JSON;
index cbd5c8f35a1caa9e19689a0280f3e3ef4c25ef61..b8efaf1adc45dcf5f8a144ba88c0ba200d0e8a36 100644 (file)
@@ -611,7 +611,7 @@ done:
 }
 
 int RGWHandler_SWIFT_Auth::init(RGWRados *store, struct req_state *state,
-                               RGWClientIO *cio)
+                               rgw::io::BasicClient *cio)
 {
   state->dialect = "swift-auth";
   state->formatter = new JSONFormatter;
index 0f559fddf9a6a6ea1723f1708c0ed5f37219ecbc..c4c7d0a076ee88badc3cd974be522a568b6996e3 100644 (file)
@@ -140,7 +140,7 @@ public:
   ~RGWHandler_SWIFT_Auth() {}
   RGWOp *op_get();
 
-  int init(RGWRados *store, struct req_state *state, RGWClientIO *cio);
+  int init(RGWRados *store, struct req_state *state, rgw::io::BasicClient *cio);
   int authorize();
   int postauth_init() { return 0; }
   int read_permissions(RGWOp *op) { return 0; }