]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rename and split STREAM_IO into RESTFUL_IO and ACCOUNTING_IO.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Wed, 17 Aug 2016 16:48:34 +0000 (18:48 +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>
src/rgw/rgw_auth_s3.cc
src/rgw/rgw_client_io.h
src/rgw/rgw_log.cc
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h

index 8baa7992b185e44aaa73cc15a554722a0d28eb4d..62d7ddab10b1ec014ff4787259a4c575c1c18951 100644 (file)
@@ -275,7 +275,7 @@ void rgw_create_s3_v4_canonical_request(struct req_state *s, const string& canon
     request_payload_hash = "UNSIGNED-PAYLOAD";
   } else {
     if (s->aws4_auth_needs_complete) {
-      request_payload_hash = STREAM_IO(s)->grab_aws4_sha256_hash();
+      request_payload_hash = RESTFUL_IO(s)->grab_aws4_sha256_hash();
     } else {
       if (s->aws4_auth_streaming_mode) {
         request_payload_hash = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
index 32621459e7573ca84d3f6ba24156f5573c030d2a..5ca3adbc226f815dd332566986b727712fa2603b 100644 (file)
@@ -213,6 +213,17 @@ public:
 }; /* RGWRestfulIO */
 
 
+/* 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 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);
+}
+
+
 class RGWClientIOStreamBuf : public std::streambuf {
 protected:
   RGWRestfulIO &rio;
index 84c66c420f4d07eeefbce4fb1ece83d9de88049e..49561735530700b7caeab2f950930a8c03b16978 100644 (file)
@@ -179,10 +179,6 @@ void rgw_log_usage_finalize()
   usage_logger = NULL;
 }
 
-static inline RGWClientIOAccounter* ACCOUNTING_IO(struct req_state* s) {
-  return dynamic_cast<RGWClientIOAccounter*>(s->cio);
-}
-
 static void log_usage(struct req_state *s, const string& op_name)
 {
   if (s->system_request) /* don't log system user operations */
index 0aa3c069e04035f0fdee4f3966d9ce31645fa0af..f5d6263fb21b843f092b77a0b10f9e249a2acb36 100644 (file)
@@ -280,7 +280,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);
+    RESTFUL_IO(s)->send_status(status, status_name);
   } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_status() returned err="
                      << e.value() << dendl;
@@ -375,7 +375,7 @@ void dump_header(struct req_state* const s,
                  const boost::string_ref& val)
 {
   try {
-    STREAM_IO(s)->send_header(name, val);
+    RESTFUL_IO(s)->send_header(name, val);
   } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_header() returned err="
                      << e.value() << dendl;
@@ -414,7 +414,7 @@ void dump_header(struct req_state* const s,
 void dump_content_length(struct req_state* const s, const uint64_t len)
 {
   try {
-    STREAM_IO(s)->send_content_length(len);
+    RESTFUL_IO(s)->send_content_length(len);
   } catch (RGWRestfulIOEngine::Exception& e) {
     ldout(s->cct, 0) << "ERROR: s->cio->send_content_length() returned err="
                      << e.value() << dendl;
@@ -425,9 +425,9 @@ void dump_content_length(struct req_state* const s, const uint64_t len)
 static void dump_chunked_encoding(struct req_state* const s)
 {
   try {
-    STREAM_IO(s)->send_chunked_transfer_encoding();
+    RESTFUL_IO(s)->send_chunked_transfer_encoding();
   } catch (RGWRestfulIOEngine::Exception& e) {
-    ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->send_chunked_transfer_encoding()"
+    ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->send_chunked_transfer_encoding()"
                      << " returned err=" << e.what() << dendl;
   }
 }
@@ -707,13 +707,13 @@ void end_header(struct req_state* s, RGWOp* op, const char *content_type,
   }
 
   try {
-    STREAM_IO(s)->complete_header();
+    RESTFUL_IO(s)->complete_header();
   } catch (RGWRestfulIOEngine::Exception& e) {
-    ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->complete_header() returned err="
+    ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->complete_header() returned err="
                     << e.value() << dendl;
   }
 
-  STREAM_IO(s)->set_account(true);
+  ACCOUNTING_IO(s)->set_account(true);
   rgw_flush_formatter_and_reset(s, s->formatter);
 }
 
@@ -785,7 +785,7 @@ void abort_early(struct req_state *s, RGWOp *op, int err_no,
        *   x-amz-error-detail-Key: foo
        */
       end_header(s, op, NULL, error_content.size(), false, true);
-      STREAM_IO(s)->send_body(error_content.c_str(), error_content.size());
+      RESTFUL_IO(s)->send_body(error_content.c_str(), error_content.size());
     } else {
       end_header(s, op);
     }
@@ -797,9 +797,9 @@ void abort_early(struct req_state *s, RGWOp *op, int err_no,
 void dump_continue(struct req_state * const s)
 {
   try {
-    STREAM_IO(s)->send_100_continue();
+    RESTFUL_IO(s)->send_100_continue();
   } catch (RGWRestfulIOEngine::Exception& e) {
-    ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->send_100_continue() returned err="
+    ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->send_100_continue() returned err="
                     << e.value() << dendl;
   }
 }
@@ -833,7 +833,7 @@ int dump_body(struct req_state* const s,
               const std::size_t len)
 {
   try {
-    return STREAM_IO(s)->send_body(buf, len);
+    return RESTFUL_IO(s)->send_body(buf, len);
   } catch (RGWRestfulIOEngine::Exception& e) {
     return e.value();
   }
@@ -854,7 +854,7 @@ int recv_body(struct req_state* const s,
               const std::size_t max)
 {
   try {
-    return STREAM_IO(s)->recv_body(buf, max, s->aws4_auth_needs_complete);
+    return RESTFUL_IO(s)->recv_body(buf, max, s->aws4_auth_needs_complete);
   } catch (RGWRestfulIOEngine::Exception& e) {
     return e.value();
   }
index b70c33ac55ef5f261364aa105438e60a23c0ef9f..37e70724072c88255a1108ce363a1a49ef911ac3 100644 (file)
@@ -30,13 +30,6 @@ extern void rgw_flush_formatter(struct req_state *s,
 extern int rgw_rest_read_all_input(struct req_state *s, char **data, int *plen,
                                   int max_len);
 
-/* 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 RGWRestfulIO* STREAM_IO(struct req_state* s) {
-  return static_cast<RGWRestfulIO*>(s->cio);
-}
-
 template <class T>
 int rgw_rest_get_json_input(CephContext *cct, req_state *s, T& out,
                            int max_len, bool *empty)