From: Radoslaw Zarzynski Date: Thu, 4 Aug 2016 15:48:11 +0000 (+0200) Subject: rgw: cleanup in the LoadGen frontend. X-Git-Tag: v11.1.0~454^2~38 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0ae4e1360cf7085989748a1614a8ba77ee6befa2;p=ceph.git rgw: cleanup in the LoadGen frontend. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_loadgen.cc b/src/rgw/rgw_loadgen.cc index 14f63a19583..634afafda7d 100644 --- a/src/rgw/rgw_loadgen.cc +++ b/src/rgw/rgw_loadgen.cc @@ -1,6 +1,8 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab +#include +#include #include #include "rgw_loadgen.h" @@ -25,7 +27,7 @@ int RGWLoadGenRequestEnv::sign(RGWAccessKey& access_key) string digest; rgw_create_s3_canonical_header(request_method.c_str(), - NULL, /* const char *content_md5 */ + nullptr, /* const char *content_md5 */ content_type.c_str(), date_str.c_str(), meta_map, @@ -44,16 +46,16 @@ int RGWLoadGenRequestEnv::sign(RGWAccessKey& access_key) return 0; } -int RGWLoadGenIO::write_data(const char *buf, int len) +int RGWLoadGenIO::write_data(const char* const buf, const int len) { return len; } -int RGWLoadGenIO::read_data(char *buf, int len) +int RGWLoadGenIO::read_data(char* const buf, const int len) { - int read_len = MIN(left_to_read, (uint64_t)len); + const int read_len = std::min(left_to_read, static_cast(len)); left_to_read -= read_len; - return read_len; + return static_cast(read_len); } void RGWLoadGenIO::flush() @@ -92,7 +94,7 @@ void RGWLoadGenIO::init_env(CephContext *cct) env.set("SERVER_PORT", port_buf); } -int RGWLoadGenIO::send_status(int status, const char *status_name) +int RGWLoadGenIO::send_status(const int status, const char* const status_name) { return 0; } @@ -107,7 +109,7 @@ int RGWLoadGenIO::complete_header() return 0; } -int RGWLoadGenIO::send_content_length(uint64_t len) +int RGWLoadGenIO::send_content_length(const uint64_t len) { return 0; } diff --git a/src/rgw/rgw_loadgen.h b/src/rgw/rgw_loadgen.h index 134c2223574..1dec5c86a50 100644 --- a/src/rgw/rgw_loadgen.h +++ b/src/rgw/rgw_loadgen.h @@ -4,21 +4,27 @@ #ifndef CEPH_RGW_LOADGEN_H #define CEPH_RGW_LOADGEN_H +#include +#include + #include "rgw_client_io.h" struct RGWLoadGenRequestEnv { int port; uint64_t content_length; - string content_type; - string request_method; - string uri; - string query_string; - string date_str; + std::string content_type; + std::string request_method; + std::string uri; + std::string query_string; + std::string date_str; - map headers; + std::map headers; - RGWLoadGenRequestEnv() : port(0), content_length(0) {} + RGWLoadGenRequestEnv() + : port(0), + content_length(0) { + } void set_date(utime_t& tm); int sign(RGWAccessKey& access_key); @@ -29,26 +35,31 @@ struct RGWLoadGenRequestEnv { class RGWLoadGenIO : public RGWStreamIOEngine { uint64_t left_to_read; - RGWLoadGenRequestEnv *req; + RGWLoadGenRequestEnv* req; RGWEnv env; + public: - void init_env(CephContext *cct); + explicit RGWLoadGenIO(RGWLoadGenRequestEnv* const req) + : left_to_read(0), + req(req) { + } - int write_data(const char *buf, int len); + void init_env(CephContext *cct); int read_data(char *buf, int len); + int write_data(const char *buf, int len); int send_status(int status, const char *status_name); int send_100_continue(); int complete_header(); - int complete_request(); int send_content_length(uint64_t len); - explicit RGWLoadGenIO(RGWLoadGenRequestEnv *_re) : left_to_read(0), req(_re) {} void flush(); RGWEnv& get_env() override { return env; } + + int complete_request(); }; #endif