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;
}
Headers>;
};
-class RGWAsioClientIO : public RGWRestfulIOEngine {
+class RGWAsioClientIO : public rgw::io::RestfulClient {
using tcp = boost::asio::ip::tcp;
tcp::socket socket;
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;
}
{
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;
}
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);
}
struct mg_connection;
-class RGWCivetWeb : public RGWRestfulIOEngine
+class RGWCivetWeb : public rgw::io::RestfulClient
{
RGWEnv env;
mg_connection *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);
#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)) {
}
}
+} /* namespace io */
+} /* namespace rgw */
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();
}
}
#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;
};
-/* 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;
}
public:
- RGWDecoratedRestfulIO(DecorateeT&& decoratee)
+ DecoratedRestfulClient(DecorateeT&& decoratee)
: decoratee(std::move(decoratee)) {
}
}
};
+} /* 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
/* 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 */
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);
}
#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) {
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
}
size_t complete_header() override {
- const auto sent = RGWDecoratedRestfulIO<T>::complete_header();
+ const auto sent = DecoratedRestfulClient<T>::complete_header();
if (enabled) {
total_sent += sent;
}
}
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;
}
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;
}
/* 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;
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) {
}
};
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(). */
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;
}
}
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));
}
* 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,
public:
template <typename U>
- RGWRestfulIOConLenControllingEngine(U&& decoratee)
- : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
+ ConLenControllingFilter(U&& decoratee)
+ : DecoratedRestfulClient<T>(std::move(decoratee)),
action(ContentLengthAction::UNKNOWN) {
}
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:
};
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. */
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;
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) {
}
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 {
content_length = len;
return 0;
} else {
- return RGWDecoratedRestfulIO<T>::send_content_length(len);
+ return DecoratedRestfulClient<T>::send_content_length(len);
}
}
/* 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 */
class RGWEnv;
-class RGWClientIO;
+namespace rgw {
+namespace io {
+class BasicClient;
+}
+}
struct req_info {
RGWEnv *env;
/** 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;
{
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;
}
{
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;
}
struct FCGX_Request;
-class RGWFCGX : public RGWRestfulIOEngine
+class RGWFCGX : public rgw::io::RestfulClient
{
FCGX_Request *fcgx;
RGWEnv env;
{
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);
/* request interface */
- class RGWLibIO : public RGWClientIO,
- public RGWClientIOAccounter
+ class RGWLibIO : public rgw::io::BasicClient,
+ public rgw::io::Accounter
{
RGWUserInfo user_info;
RGWEnv env;
/* 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;
{
}
-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;
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;
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;
}
{
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;
}
{
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;
}
{
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;
}
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;
}
{
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;
}
{
try {
return RESTFUL_IO(s)->send_body(buf, len);
- } catch (RGWRestfulIOEngine::Exception& e) {
+ } catch (rgw::io::RestfulClient::Exception& e) {
return -e.code().value();
}
}
{
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();
}
}
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;
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,
}
int RGWHandler_REST_S3::init(RGWRados *store, struct req_state *s,
- RGWClientIO *cio)
+ rgw::io::BasicClient *cio)
{
int ret;
}
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);
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);
}
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);
}
}
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;
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;
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);
}
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);
}
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;
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;
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;
}
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;
~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; }