// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
+#include <algorithm>
+#include <sstream>
#include <string.h>
#include "rgw_loadgen.h"
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,
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<uint64_t>(len));
left_to_read -= read_len;
- return read_len;
+ return static_cast<int>(read_len);
}
void RGWLoadGenIO::flush()
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;
}
return 0;
}
-int RGWLoadGenIO::send_content_length(uint64_t len)
+int RGWLoadGenIO::send_content_length(const uint64_t len)
{
return 0;
}
#ifndef CEPH_RGW_LOADGEN_H
#define CEPH_RGW_LOADGEN_H
+#include <map>
+#include <string>
+
#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<string, string> headers;
+ std::map<std::string, std::string> headers;
- RGWLoadGenRequestEnv() : port(0), content_length(0) {}
+ RGWLoadGenRequestEnv()
+ : port(0),
+ content_length(0) {
+ }
void set_date(utime_t& tm);
int sign(RGWAccessKey& access_key);
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