]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: change naming based on RGWStreamIO in favor of RGWRestfulIO.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Wed, 17 Aug 2016 09:58:54 +0000 (11:58 +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>
19 files changed:
src/rgw/rgw_asio_client.cc
src/rgw/rgw_asio_client.h
src/rgw/rgw_asio_frontend.cc
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_fcgi.cc
src/rgw/rgw_fcgi.h
src/rgw/rgw_fcgi_process.cc
src/rgw/rgw_loadgen.h
src/rgw/rgw_loadgen_process.cc
src/rgw/rgw_process.cc
src/rgw/rgw_process.h
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_swift.cc

index d9696d3a35c2482c6a754e7c8a5e0106ea08a2d1..7b2dcf80decfb7eceee1410d878372e5ca487b6d 100644 (file)
@@ -85,7 +85,7 @@ std::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 RGWStreamIOEngine::Exception(-ec.value());
+    throw RGWRestfulIOEngine::Exception(-ec.value());
   }
   return bytes;
 }
index 13bda9d7f20d5a894b68ff9cf45b948ce6ffd6b0..fc3d3577c22eea183fae677b5fb2841ebaba8750 100644 (file)
@@ -24,7 +24,7 @@ class RGWBufferlistBody {
                                             Headers>;
 };
 
-class RGWAsioClientIO : public RGWStreamIOEngine {
+class RGWAsioClientIO : public RGWRestfulIOEngine {
   using tcp = boost::asio::ip::tcp;
   tcp::socket socket;
 
index 6d7b1b12699a496e37977c92e6cedb833217e8ac..a7bda0b3ed24bdd59292bc5fe20e369b2cf44064 100644 (file)
@@ -93,7 +93,7 @@ class AsioConnection : public std::enable_shared_from_this<AsioConnection> {
     }
     RGWRequest req{env.store->get_new_req_id()};
     RGWAsioClientIO real_client{std::move(socket), std::move(request)};
-    RGWStreamIOLegacyWrapper client(&real_client);
+    RGWRestfulIO client(&real_client);
     process_request(env.store, env.rest, &req, &client, env.olog);
   }
 
index fd245138f3fa1e503d865e10ae48a1d140d0fc98..68ea8f27bb0944e669e46d0e0a58b254a4c37dee 100644 (file)
@@ -17,9 +17,9 @@ std::size_t RGWCivetWeb::write_data(const char *buf, std::size_t len)
   const int ret = mg_write(conn, buf, len);
   if (ret == 0) {
     /* didn't send anything, error out */
-    throw RGWStreamIOEngine::Exception(-EIO);
+    throw RGWRestfulIOEngine::Exception(-EIO);
   } else if (ret < 0) {
-    throw RGWStreamIOEngine::Exception(ret);
+    throw RGWRestfulIOEngine::Exception(ret);
   }
   return ret;
 }
@@ -36,7 +36,7 @@ std::size_t RGWCivetWeb::read_data(char *buf, std::size_t len)
 {
   const int ret = mg_read(conn, buf, len);
   if (ret < 0) {
-    throw RGWStreamIOEngine::Exception(ret);
+    throw RGWRestfulIOEngine::Exception(ret);
   }
   return ret;
 }
@@ -121,9 +121,9 @@ static inline std::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 RGWStreamIOEngine::Exception(-EIO);
+    throw RGWRestfulIOEngine::Exception(-EIO);
   } else if (ret < 0) {
-    throw RGWStreamIOEngine::Exception(ret);
+    throw RGWRestfulIOEngine::Exception(ret);
   }
   return static_cast<std::size_t>(ret);
 }
index 7837f2102ee193aecfed547912cb128d12794005..86a60263cf318752a7cd90800d1a98752dcf868b 100644 (file)
@@ -10,7 +10,7 @@
 
 struct mg_connection;
 
-class RGWCivetWeb : public RGWStreamIOEngine
+class RGWCivetWeb : public RGWRestfulIOEngine
 {
   RGWEnv env;
   mg_connection *conn;
index d1537f8898162afa411c92c0af12d2c62bc676ae..4de32b4cd197036487fbf81c18728c0a67189098 100644 (file)
@@ -23,8 +23,12 @@ int RGWCivetWebFrontend::process(struct mg_connection*  const conn)
   RWLock::RLocker lock(env.mutex);
 
   RGWRequest req(env.store->get_new_req_id());
-  RGWCivetWeb real_client_io(conn, env.port);
-  RGWStreamIOLegacyWrapper client_io(&real_client_io);
+  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(
+                                RGWCivetWeb(conn, env.port)))));
+  RGWRestfulIO client_io(&real_client_io);
 
   int ret = process_request(env.store, env.rest, &req, &client_io, env.olog);
   if (ret < 0) {
index 0d540bf1bab26d0198dc94e227ad475ccf8be33c..39f429aabfe0d59ee078122738ebaaab39715944 100644 (file)
@@ -23,7 +23,7 @@ void RGWClientIO::init(CephContext *cct) {
 }
 
 
-int RGWStreamIO::recv_body(char *buf, std::size_t max, bool calculate_hash)
+int RGWRestfulIO::recv_body(char *buf, std::size_t max, bool calculate_hash)
 {
   try {
     const auto sent = recv_body(buf, max);
@@ -35,12 +35,12 @@ int RGWStreamIO::recv_body(char *buf, std::size_t max, bool calculate_hash)
       calc_hash_sha256_update_stream(sha256_hash, buf, sent);
     }
     return sent;
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     return e.value();
   }
 }
 
-string RGWStreamIO::grab_aws4_sha256_hash()
+string RGWRestfulIO::grab_aws4_sha256_hash()
 {
   return calc_hash_sha256_close_stream(&sha256_hash);
 }
index 68847a3dd46bf3e32744623f5ef798db6d45c599..647b8a755654564f998b43779be6abeabf1dadbd 100644 (file)
@@ -39,9 +39,8 @@ public:
 };
 
 
-class RGWStreamIOEngine : public RGWClientIO {
-  friend class RGWStreamIOLegacyWrapper;
-  template<typename T> friend class RGWDecoratedStreamIO;
+class RGWRestfulIOEngine : public RGWClientIO {
+  template<typename T> friend class RGWDecoratedRestfulIO;
 
 public:
   class Exception : public std::exception {
@@ -94,15 +93,15 @@ public:
 };
 
 
-/* Abstract decorator over any implementation of RGWStreamIOEngine. */
+/* Abstract decorator over any implementation of RGWRestfulIOEngine. */
 template <typename DecorateeT>
-class RGWDecoratedStreamIO : public RGWStreamIOEngine {
-  template<typename T> friend class RGWDecoratedStreamIO;
+class RGWDecoratedRestfulIO : public RGWRestfulIOEngine {
+  template<typename T> friend class RGWDecoratedRestfulIO;
 
   typedef typename std::remove_pointer<DecorateeT>::type DerefedDecorateeT;
 
-  static_assert(std::is_base_of<RGWStreamIOEngine, DerefedDecorateeT>::value,
-                "DecorateeT must be a subclass of RGWStreamIOEngine");
+  static_assert(std::is_base_of<RGWRestfulIOEngine, DerefedDecorateeT>::value,
+                "DecorateeT must be a subclass of RGWRestfulIOEngine");
 
   DecorateeT decoratee;
 
@@ -130,7 +129,7 @@ protected:
   }
 
 public:
-  RGWDecoratedStreamIO(DecorateeT&& decoratee)
+  RGWDecoratedRestfulIO(DecorateeT&& decoratee)
     : decoratee(std::move(decoratee)) {
   }
 
@@ -184,8 +183,8 @@ public:
 
 
 /* HTTP IO: compatibility layer */
-class RGWStreamIO : public RGWClientIOAccounter,
-                    public RGWDecoratedStreamIO<RGWStreamIOEngine*> {
+class RGWRestfulIO : public RGWClientIOAccounter,
+                     public RGWDecoratedRestfulIO<RGWRestfulIOEngine*> {
 protected:
   bool _account;
   size_t bytes_sent;
@@ -200,17 +199,17 @@ protected:
   RGWEnv env;
 
 public:
-  virtual ~RGWStreamIO() {}
+  virtual ~RGWRestfulIO() {}
 
-  RGWStreamIO(RGWStreamIOEngine* engine)
-    : RGWDecoratedStreamIO<RGWStreamIOEngine*>(std::move(engine)),
+  RGWRestfulIO(RGWRestfulIOEngine* engine)
+    : RGWDecoratedRestfulIO<RGWRestfulIOEngine*>(std::move(engine)),
       _account(false),
       bytes_sent(0),
       bytes_received(0),
       sha256_hash(nullptr) {
   }
 
-  using RGWDecoratedStreamIO<RGWStreamIOEngine*>::recv_body;
+  using RGWDecoratedRestfulIO<RGWRestfulIOEngine*>::recv_body;
   virtual int recv_body(char* buf, std::size_t max, bool calculate_hash);
   std::string grab_aws4_sha256_hash();
 
@@ -229,31 +228,19 @@ public:
   uint64_t get_bytes_received() const override {
     return bytes_received;
   }
-}; /* RGWStreamIO */
-
-
-/* A class for preserving interface compatibility with RGWStreamIO clients
- * while allowing front-end migration to the new API. We don't multi-inherit
- * from RGWDecoratedStreamIO<> to avoid using virtual inheritance in engine.
- * Should be removed after converting all clients. */
-class RGWStreamIOLegacyWrapper : public RGWStreamIO {
-public:
-  RGWStreamIOLegacyWrapper(RGWStreamIOEngine * const engine)
-    : RGWStreamIO(std::move(engine)) {
-  }
-};
+}; /* RGWRestfulIO */
 
 
 class RGWClientIOStreamBuf : public std::streambuf {
 protected:
-  RGWStreamIO &sio;
+  RGWRestfulIO &rio;
   std::size_t const window_size;
   std::size_t const putback_size;
   std::vector<char> buffer;
 
 public:
-  RGWClientIOStreamBuf(RGWStreamIO &s, std::size_t ws, std::size_t ps = 1)
-    : sio(s),
+  RGWClientIOStreamBuf(RGWRestfulIO &rio, std::size_t ws, std::size_t ps = 1)
+    : rio(rio),
       window_size(ws),
       putback_size(ps),
       buffer(ws + ps)
@@ -279,7 +266,7 @@ public:
       start = base;
     }
 
-    const int read_len = sio.recv_body(base, window_size, false);
+    const int read_len = rio.recv_body(base, window_size, false);
     if (read_len < 0 || 0 == read_len) {
       return traits_type::eof();
     }
@@ -296,7 +283,7 @@ class RGWClientIOStream : private RGWClientIOStreamBuf, public std::istream {
  * ctor is being called prior to construction of any member of this class. */
 
 public:
-  explicit RGWClientIOStream(RGWStreamIO &s)
+  explicit RGWClientIOStream(RGWRestfulIO &s)
     : RGWClientIOStreamBuf(s, 1, 2),
       istream(static_cast<RGWClientIOStreamBuf *>(this)) {
   }
index 4d1c046dab8f7163d2306e8d1f536c6c5ad589c4..66f2d563892a98e5b53de505eb3457edd832a7e7 100644 (file)
 #include "rgw_client_io.h"
 
 template <typename T>
-class RGWStreamIOAccountingEngine : public RGWDecoratedStreamIO<T>,
-                                    public RGWClientIOAccounter {
+class RGWRestfulIOAccountingEngine : public RGWDecoratedRestfulIO<T>,
+                                     public RGWClientIOAccounter {
   bool enabled;
   uint64_t total_sent;
   uint64_t total_received;
 
 public:
   template <typename U>
-  RGWStreamIOAccountingEngine(U&& decoratee)
-    : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+  RGWRestfulIOAccountingEngine(U&& decoratee)
+    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
       enabled(false),
       total_sent(0),
       total_received(0) {
@@ -29,7 +29,7 @@ public:
 
   std::size_t send_status(const int status,
                           const char* const status_name) override {
-    const auto sent = RGWDecoratedStreamIO<T>::send_status(status, status_name);
+    const auto sent = RGWDecoratedRestfulIO<T>::send_status(status, status_name);
     if (enabled) {
       total_sent += sent;
     }
@@ -37,7 +37,7 @@ public:
   }
 
   std::size_t send_100_continue() override {
-    const auto sent = RGWDecoratedStreamIO<T>::send_100_continue();
+    const auto sent = RGWDecoratedRestfulIO<T>::send_100_continue();
     if (enabled) {
       total_sent += sent;
     }
@@ -46,7 +46,7 @@ public:
 
   std::size_t send_header(const boost::string_ref& name,
                           const boost::string_ref& value) override {
-    const auto sent = RGWDecoratedStreamIO<T>::send_header(name, value);
+    const auto sent = RGWDecoratedRestfulIO<T>::send_header(name, value);
     if (enabled) {
       total_sent += sent;
     }
@@ -54,7 +54,7 @@ public:
   }
 
   std::size_t send_content_length(const uint64_t len) override {
-    const auto sent = RGWDecoratedStreamIO<T>::send_content_length(len);
+    const auto sent = RGWDecoratedRestfulIO<T>::send_content_length(len);
     if (enabled) {
       total_sent += sent;
     }
@@ -62,7 +62,7 @@ public:
   }
 
   std::size_t send_chunked_transfer_encoding() override {
-    const auto sent = RGWDecoratedStreamIO<T>::send_chunked_transfer_encoding();
+    const auto sent = RGWDecoratedRestfulIO<T>::send_chunked_transfer_encoding();
     if (enabled) {
       total_sent += sent;
     }
@@ -70,7 +70,7 @@ public:
   }
 
   std::size_t complete_header() override {
-    const auto sent = RGWDecoratedStreamIO<T>::complete_header();
+    const auto sent = RGWDecoratedRestfulIO<T>::complete_header();
     if (enabled) {
       total_sent += sent;
     }
@@ -78,7 +78,7 @@ public:
   }
 
   std::size_t recv_body(char* buf, std::size_t max) override {
-    const auto received = RGWDecoratedStreamIO<T>::recv_body(buf, max);
+    const auto received = RGWDecoratedRestfulIO<T>::recv_body(buf, max);
     if (enabled) {
       total_received += received;
     }
@@ -87,7 +87,7 @@ public:
 
   std::size_t send_body(const char* const buf,
                         const std::size_t len) override {
-    const auto sent = RGWDecoratedStreamIO<T>::send_body(buf, len);
+    const auto sent = RGWDecoratedRestfulIO<T>::send_body(buf, len);
     if (enabled) {
       total_sent += sent;
     }
@@ -111,8 +111,8 @@ public:
 /* Filter for in-memory buffering incoming data and calculating the content
  * length header if it isn't present. */
 template <typename T>
-class RGWStreamIOBufferingEngine : public RGWDecoratedStreamIO<T> {
-  template<typename Td> friend class RGWDecoratedStreamIO;
+class RGWRestfulIOBufferingEngine : public RGWDecoratedRestfulIO<T> {
+  template<typename Td> friend class RGWDecoratedRestfulIO;
 protected:
   ceph::bufferlist data;
 
@@ -121,8 +121,8 @@ protected:
 
 public:
   template <typename U>
-  RGWStreamIOBufferingEngine(U&& decoratee)
-    : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+  RGWRestfulIOBufferingEngine(U&& decoratee)
+    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
       has_content_length(false),
       buffer_data(false) {
   }
@@ -135,33 +135,33 @@ public:
 };
 
 template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::send_body(const char* const buf,
-                                                     const std::size_t len)
+std::size_t RGWRestfulIOBufferingEngine<T>::send_body(const char* const buf,
+                                                      const std::size_t len)
 {
   if (buffer_data) {
     data.append(buf, len);
     return 0;
   }
 
-  return RGWDecoratedStreamIO<T>::send_body(buf, len);
+  return RGWDecoratedRestfulIO<T>::send_body(buf, len);
 }
 
 template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::send_content_length(const uint64_t len)
+std::size_t RGWRestfulIOBufferingEngine<T>::send_content_length(const uint64_t len)
 {
   has_content_length = true;
-  return RGWDecoratedStreamIO<T>::send_content_length(len);
+  return RGWDecoratedRestfulIO<T>::send_content_length(len);
 }
 
 template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::send_chunked_transfer_encoding()
+std::size_t RGWRestfulIOBufferingEngine<T>::send_chunked_transfer_encoding()
 {
   has_content_length = true;
-  return RGWDecoratedStreamIO<T>::send_chunked_transfer_encoding();
+  return RGWDecoratedRestfulIO<T>::send_chunked_transfer_encoding();
 }
 
 template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::complete_header()
+std::size_t RGWRestfulIOBufferingEngine<T>::complete_header()
 {
   if (! has_content_length) {
     /* We will dump everything in complete_request(). */
@@ -169,73 +169,78 @@ std::size_t RGWStreamIOBufferingEngine<T>::complete_header()
     return 0;
   }
 
-  return RGWDecoratedStreamIO<T>::complete_header();
+  return RGWDecoratedRestfulIO<T>::complete_header();
 }
 
 template <typename T>
-int RGWStreamIOBufferingEngine<T>::complete_request()
+int RGWRestfulIOBufferingEngine<T>::complete_request()
 {
   size_t sent = 0;
 
   if (! has_content_length) {
-    sent += RGWDecoratedStreamIO<T>::send_content_length(data.length());
-    sent += RGWDecoratedStreamIO<T>::complete_header();
+    sent += RGWDecoratedRestfulIO<T>::send_content_length(data.length());
+    sent += RGWDecoratedRestfulIO<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 += RGWDecoratedStreamIO<T>::send_body(ptr.c_str(),
-                                                 ptr.length());
+      sent += RGWDecoratedRestfulIO<T>::send_body(ptr.c_str(),
+                                                  ptr.length());
     }
     data.clear();
     buffer_data = false;
   }
 
-  return sent + RGWDecoratedStreamIO<T>::complete_request();
+  return sent + RGWDecoratedRestfulIO<T>::complete_request();
+}
+
+template <typename T> static inline
+RGWRestfulIOBufferingEngine<T> rgw_restful_io_add_buffering(T&& t) {
+  return RGWRestfulIOBufferingEngine<T>(std::move(t));
 }
 
 
 template <typename T>
-class RGWStreamIOChunkingEngine : public RGWDecoratedStreamIO<T> {
-  template<typename Td> friend class RGWDecoratedStreamIO;
+class RGWRestfulIOChunkingEngine : public RGWDecoratedRestfulIO<T> {
+  template<typename Td> friend class RGWDecoratedRestfulIO;
 protected:
   bool has_content_length;
   bool chunking_enabled;
 
 public:
   template <typename U>
-  RGWStreamIOChunkingEngine(U&& decoratee)
-    : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+  RGWRestfulIOChunkingEngine(U&& decoratee)
+    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
       has_content_length(false),
       chunking_enabled(false) {
   }
 
   std::size_t send_content_length(const uint64_t len) override {
     has_content_length = true;
-    return RGWDecoratedStreamIO<T>::send_content_length(len);
+    return RGWDecoratedRestfulIO<T>::send_content_length(len);
   }
 
   std::size_t send_chunked_transfer_encoding() override {
     has_content_length = false;
     chunking_enabled = true;
-    return RGWDecoratedStreamIO<T>::send_header("Transfer-Encoding", "chunked");
+    return RGWDecoratedRestfulIO<T>::send_header("Transfer-Encoding", "chunked");
   }
 
   std::size_t send_body(const char* buf,
                         const std::size_t len) override {
     if (! chunking_enabled) {
-      return RGWDecoratedStreamIO<T>::send_body(buf, len);
+      return RGWDecoratedRestfulIO<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);
       std::size_t sent = 0;
 
-      sent += RGWDecoratedStreamIO<T>::send_body(sizebuf, slen);
-      sent += RGWDecoratedStreamIO<T>::send_body(buf, len);
-      sent += RGWDecoratedStreamIO<T>::send_body(HEADER_END,
+      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);
       return sent;
     }
@@ -246,17 +251,17 @@ public:
 
     if (chunking_enabled) {
       static constexpr char CHUNKED_RESP_END[] = "0\r\n\r\n";
-      sent += RGWDecoratedStreamIO<T>::send_body(CHUNKED_RESP_END,
-                                                 sizeof(CHUNKED_RESP_END) - 1);
+      sent += RGWDecoratedRestfulIO<T>::send_body(CHUNKED_RESP_END,
+                                                  sizeof(CHUNKED_RESP_END) - 1);
     }
 
-    return sent + RGWDecoratedStreamIO<T>::complete_request();
+    return sent + RGWDecoratedRestfulIO<T>::complete_request();
   }
 };
 
-template <typename T>
-RGWStreamIOChunkingEngine<T> add_chunking(T&& t) {
-  return RGWStreamIOChunkingEngine<T>(std::move(t));
+template <typename T> static inline
+RGWRestfulIOChunkingEngine<T> rgw_restful_io_add_chunking(T&& t) {
+  return RGWRestfulIOChunkingEngine<T>(std::move(t));
 }
 
 
@@ -264,7 +269,7 @@ RGWStreamIOChunkingEngine<T> 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 RGWStreamIOConLenControllingEngine : public RGWDecoratedStreamIO<T> {
+class RGWRestfulIOConLenControllingEngine : public RGWDecoratedRestfulIO<T> {
 protected:
   enum class ContentLengthAction {
     FORWARD,
@@ -274,8 +279,8 @@ protected:
 
 public:
   template <typename U>
-  RGWStreamIOConLenControllingEngine(U&& decoratee)
-    : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+  RGWRestfulIOConLenControllingEngine(U&& decoratee)
+    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
       action(ContentLengthAction::UNKNOWN) {
   }
 
@@ -287,13 +292,13 @@ public:
       action = ContentLengthAction::FORWARD;
     }
 
-    return RGWDecoratedStreamIO<T>::send_status(status, status_name);
+    return RGWDecoratedRestfulIO<T>::send_status(status, status_name);
   }
 
   std::size_t send_content_length(const uint64_t len) override {
     switch(action) {
     case ContentLengthAction::FORWARD:
-      return RGWDecoratedStreamIO<T>::send_content_length(len);
+      return RGWDecoratedRestfulIO<T>::send_content_length(len);
     case ContentLengthAction::INHIBIT:
       return 0;
     case ContentLengthAction::UNKNOWN:
@@ -303,16 +308,16 @@ public:
   }
 };
 
-template <typename T>
-RGWStreamIOConLenControllingEngine<T> add_conlen_controlling(T&& t) {
-  return RGWStreamIOConLenControllingEngine<T>(std::move(t));
+template <typename T> static inline
+RGWRestfulIOConLenControllingEngine<T> rgw_restful_io_add_conlen_controlling(T&& t) {
+  return RGWRestfulIOConLenControllingEngine<T>(std::move(t));
 }
 
 
-/* Filter that rectifies the wrong behaviour of some clients of the RGWStreamIO
+/* Filter that rectifies the wrong behaviour of some clients of the RGWRestfulIO
  * interface. Should be removed after fixing those clients. */
 template <typename T>
-class RGWStreamIOReorderingEngine : public RGWDecoratedStreamIO<T> {
+class RGWRestfulIOReorderingEngine : public RGWDecoratedRestfulIO<T> {
 protected:
   enum class ReorderState {
     RGW_EARLY_HEADERS,  /* Got headers sent before calling send_status. */
@@ -333,7 +338,7 @@ protected:
                                           value.to_string()));
       return 0;
     case ReorderState::RGW_DATA:
-      return RGWDecoratedStreamIO<T>::send_header(name, value);
+      return RGWDecoratedRestfulIO<T>::send_header(name, value);
     }
 
     return -EIO;
@@ -341,8 +346,8 @@ protected:
 
 public:
   template <typename U>
-  RGWStreamIOReorderingEngine(U&& decoratee)
-    : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+  RGWRestfulIOReorderingEngine(U&& decoratee)
+    : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
       phase(ReorderState::RGW_EARLY_HEADERS) {
   }
 
@@ -350,7 +355,7 @@ public:
                           const char* const status_name) override {
     phase = ReorderState::RGW_STATUS_SEEN;
 
-    return RGWDecoratedStreamIO<T>::send_status(status, status_name);
+    return RGWDecoratedRestfulIO<T>::send_status(status, status_name);
   }
 
   std::size_t send_content_length(const uint64_t len) override {
@@ -359,7 +364,7 @@ public:
       content_length = len;
       return 0;
     } else {
-      return RGWDecoratedStreamIO<T>::send_content_length(len);
+      return RGWDecoratedRestfulIO<T>::send_content_length(len);
     }
   }
 
@@ -371,22 +376,22 @@ public:
 
     /* Sent content length if necessary. */
     if (content_length) {
-      sent += RGWDecoratedStreamIO<T>::send_content_length(*content_length);
+      sent += RGWDecoratedRestfulIO<T>::send_content_length(*content_length);
     }
 
     /* Header data in buffers are already counted. */
     for (const auto& kv : headers) {
-      sent += RGWDecoratedStreamIO<T>::send_header(kv.first, kv.second);
+      sent += RGWDecoratedRestfulIO<T>::send_header(kv.first, kv.second);
     }
     headers.clear();
 
-    return sent + RGWDecoratedStreamIO<T>::complete_header();
+    return sent + RGWDecoratedRestfulIO<T>::complete_header();
   }
 };
 
-template <typename T>
-RGWStreamIOReorderingEngine<T> add_reordering(T&& t) {
-  return RGWStreamIOReorderingEngine<T>(std::move(t));
+template <typename T> static inline
+RGWRestfulIOReorderingEngine<T> rgw_restful_io_add_reordering(T&& t) {
+  return RGWRestfulIOReorderingEngine<T>(std::move(t));
 }
 
 #endif /* CEPH_RGW_CLIENT_IO_DECOIMPL_H */
index 9cd64ee4616d728d382e017b230ec02fbbcf69f4..d08635e61c86f632101ff13eb8f02e756104a1f6 100644 (file)
@@ -9,7 +9,7 @@ std::size_t RGWFCGX::write_data(const char* const buf, const std::size_t len)
 {
   const auto ret = FCGX_PutStr(buf, len, fcgx->out);
   if (ret < 0) {
-    throw RGWStreamIOEngine::Exception(ret);
+    throw RGWRestfulIOEngine::Exception(ret);
   }
   return ret;
 }
@@ -18,7 +18,7 @@ std::size_t RGWFCGX::read_data(char* const buf, const std::size_t len)
 {
   const auto ret = FCGX_GetStr(buf, len, fcgx->in);
   if (ret < 0) {
-    throw RGWStreamIOEngine::Exception(ret);
+    throw RGWRestfulIOEngine::Exception(ret);
   }
   return ret;
 }
index 0835cecdbebc5d2c23a18fc00c76c3e3d1dbedb6..c0d9d4ad772506f35627c948a4c33ddd907b3850 100644 (file)
@@ -11,7 +11,7 @@
 
 struct FCGX_Request;
 
-class RGWFCGX : public RGWStreamIOEngine
+class RGWFCGX : public RGWRestfulIOEngine
 {
   FCGX_Request *fcgx;
   RGWEnv env;
index 7bc469befb6d1a32019ccc7cbcd35927c2bfeea5..554cf2c64a832e21113dad0b3ba827ffb5486912 100644 (file)
@@ -116,9 +116,9 @@ void RGWFCGXProcess::handle_request(RGWRequest* r)
 {
   RGWFCGXRequest* req = static_cast<RGWFCGXRequest*>(r);
   FCGX_Request* fcgx = req->fcgx;
-  auto real_client_io = add_conlen_controlling(
+  auto real_client_io = rgw_restful_io_add_conlen_controlling(
                           RGWFCGX(fcgx));
-  RGWStreamIOLegacyWrapper client_io(&real_client_io);
+  RGWRestfulIO client_io(&real_client_io);
 
  
   int ret = process_request(store, rest, req, &client_io, olog);
index ae271e78c341122de3328a55b2ecf1fff2cdfcf9..329d121cbf28713e1084e921ce8267b0b8b97269 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 RGWStreamIOEngine
+class RGWLoadGenIO : public RGWRestfulIOEngine
 {
   uint64_t left_to_read;
   RGWLoadGenRequestEnv* req;
index 8303237d0da19826f839c468ca610eb2b55b7650..d857d6c540e7811b65a53f3670e1476b67df6bd2 100644 (file)
@@ -129,7 +129,7 @@ void RGWLoadGenProcess::handle_request(RGWRequest* r)
   env.sign(access_key);
 
   RGWLoadGenIO real_client_io(&env);
-  RGWStreamIOLegacyWrapper client_io(&real_client_io);
+  RGWRestfulIO client_io(&real_client_io);
 
   int ret = process_request(store, rest, req, &client_io, olog);
   if (ret < 0) {
index b57d72c3693926e7be9425d9a50672442f0c1d60..3304db6ff1a9d378bbed991a2aee3c5c6ba43df0 100644 (file)
@@ -110,7 +110,7 @@ int rgw_process_authenticated(RGWHandler_REST * const handler,
 }
 
 int process_request(RGWRados* store, RGWREST* rest, RGWRequest* req,
-                   RGWStreamIO* client_io, OpsLogSocket* olog)
+                   RGWRestfulIO* client_io, OpsLogSocket* olog)
 {
   int ret = 0;
 
index 6e69437e7cf3d5e4ac936005f9b2be6b3cd17319..7c27041a6d88bbfde58098caa1171a98b64b663f 100644 (file)
@@ -173,7 +173,7 @@ public:
 extern int process_request(RGWRados* store,
                            RGWREST* rest,
                            RGWRequest* req,
-                          RGWStreamIO* client_io,
+                          RGWRestfulIO* client_io,
                            OpsLogSocket* olog);
 
 extern int rgw_process_authenticated(RGWHandler_REST* handler,
index 41c158d3e620b0c282769fd34a16d9d053c90b77..0aa3c069e04035f0fdee4f3966d9ce31645fa0af 100644 (file)
@@ -281,7 +281,7 @@ static void dump_status(struct req_state *s, int status,
   s->formatter->set_status(status, status_name);
   try {
     STREAM_IO(s)->send_status(status, status_name);
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_status() returned err="
                      << e.value() << dendl;
   }
@@ -376,7 +376,7 @@ void dump_header(struct req_state* const s,
 {
   try {
     STREAM_IO(s)->send_header(name, val);
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_header() returned err="
                      << e.value() << dendl;
   }
@@ -415,7 +415,7 @@ void dump_content_length(struct req_state* const s, const uint64_t len)
 {
   try {
     STREAM_IO(s)->send_content_length(len);
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_content_length() returned err="
                      << e.value() << dendl;
   }
@@ -708,7 +708,7 @@ void end_header(struct req_state* s, RGWOp* op, const char *content_type,
 
   try {
     STREAM_IO(s)->complete_header();
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->complete_header() returned err="
                     << e.value() << dendl;
   }
@@ -798,7 +798,7 @@ void dump_continue(struct req_state * const s)
 {
   try {
     STREAM_IO(s)->send_100_continue();
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->send_100_continue() returned err="
                     << e.value() << dendl;
   }
@@ -834,7 +834,7 @@ int dump_body(struct req_state* const s,
 {
   try {
     return STREAM_IO(s)->send_body(buf, len);
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     return e.value();
   }
 }
@@ -855,7 +855,7 @@ int recv_body(struct req_state* const s,
 {
   try {
     return STREAM_IO(s)->recv_body(buf, max, s->aws4_auth_needs_complete);
-  } catch (RGWStreamIOEngine::Exception& e) {
+  } catch (RGWRestfulIOEngine::Exception& e) {
     return e.value();
   }
 }
@@ -2043,12 +2043,12 @@ int RGWREST::preprocess(struct req_state *s, RGWClientIO* cio)
 }
 
 RGWHandler_REST* RGWREST::get_handler(RGWRados *store, struct req_state *s,
-                                     RGWStreamIO *sio, RGWRESTMgr **pmgr,
+                                     RGWRestfulIO *rio, RGWRESTMgr **pmgr,
                                      int *init_error)
 {
   RGWHandler_REST* handler;
 
-  *init_error = preprocess(s, sio);
+  *init_error = preprocess(s, rio);
   if (*init_error < 0)
     return NULL;
 
@@ -2066,7 +2066,7 @@ RGWHandler_REST* RGWREST::get_handler(RGWRados *store, struct req_state *s,
     *init_error = -ERR_METHOD_NOT_ALLOWED;
     return NULL;
   }
-  *init_error = handler->init(store, s, sio);
+  *init_error = handler->init(store, s, rio);
   if (*init_error < 0) {
     m->put_handler(handler);
     return NULL;
index 510747e01489cebee2ac52609534e858eda42df7..b70c33ac55ef5f261364aa105438e60a23c0ef9f 100644 (file)
@@ -33,8 +33,8 @@ extern int rgw_rest_read_all_input(struct req_state *s, char **data, int *plen,
 /* type conversions to work around lack of req_state type
  * hierarchy matching (e.g.) REST backends (may be replaced w/dynamic
  * typed req_state) */
-static inline RGWStreamIO* STREAM_IO(struct req_state* s) {
-  return static_cast<RGWStreamIO*>(s->cio);
+static inline RGWRestfulIO* STREAM_IO(struct req_state* s) {
+  return static_cast<RGWRestfulIO*>(s->cio);
 }
 
 template <class T>
@@ -152,8 +152,6 @@ public:
   }
 };
 
-class RGWStreamIO;
-
 class RGWGetObj_ObjStore : public RGWGetObj
 {
 protected:
@@ -481,16 +479,19 @@ public:
 };
 
 class RGWLibIO;
+class RGWRestfulIO;
 
 class RGWREST {
   RGWRESTMgr mgr;
 
-  static int preprocess(struct req_state *s, RGWClientIO *sio);
+  static int preprocess(struct req_state *s, RGWClientIO *rio);
 public:
   RGWREST() {}
-  RGWHandler_REST *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,
+                               RGWRestfulIO *rio,
+                               RGWRESTMgr **pmgr,
+                               int *init_error);
 #if 0
   RGWHandler *get_handler(RGWRados *store, struct req_state *s,
                          RGWLibIO *io, RGWRESTMgr **pmgr,
index ab0aa6ca07e25394af9d728915cb56e135262404..5745b7a723d1c92941072e2da6c7dabc9342ca8b 100644 (file)
@@ -1335,7 +1335,7 @@ int RGWBulkDelete_ObjStore_SWIFT::get_data(
 {
   constexpr size_t MAX_LINE_SIZE = 2048;
 
-  RGWClientIOStreamBuf ciosb(static_cast<RGWStreamIO&>(*(s->cio)),
+  RGWClientIOStreamBuf ciosb(static_cast<RGWRestfulIO&>(*(s->cio)),
                             std::size_t(s->cct->_conf->rgw_max_chunk_size));
   istream cioin(&ciosb);