summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_rest_client.h
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@redhat.com>2017-10-31 17:44:15 +0100
committerYehuda Sadeh <yehuda@redhat.com>2018-04-10 17:05:39 +0200
commitb7102750a72cfca682051e9bacf591693d9b70d5 (patch)
treea9fa9ab5e5739e5a55a6adb042d6a48f705bab96 /src/rgw/rgw_rest_client.h
parentrgw: cr: introduce io channels (diff)
downloadceph-b7102750a72cfca682051e9bacf591693d9b70d5.tar.xz
ceph-b7102750a72cfca682051e9bacf591693d9b70d5.zip
rgw: cr rest splice, work towards write throttling
Need to throttle writes, so that we don't just accumulate all data read from source endpoint in memory, in the case where the write endpoint is too slow. Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
Diffstat (limited to '')
-rw-r--r--src/rgw/rgw_rest_client.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rgw/rgw_rest_client.h b/src/rgw/rgw_rest_client.h
index 277263bc972..964aa0dff7c 100644
--- a/src/rgw/rgw_rest_client.h
+++ b/src/rgw/rgw_rest_client.h
@@ -69,11 +69,19 @@ public:
int forward_request(RGWAccessKey& key, req_info& info, size_t max_response, bufferlist *inbl, bufferlist *outbl);
};
+class RGWWriteDrainCB {
+public:
+ RGWWriteDrainCB() = default;
+ virtual ~RGWWriteDrainCB() = default;
+ virtual void notify(uint64_t pending_size) = 0;
+};
+
class RGWHTTPStreamRWRequest : public RGWHTTPSimpleRequest {
Mutex lock;
Mutex write_lock;
RGWGetDataCB *cb{nullptr};
+ RGWWriteDrainCB *write_drain_cb{nullptr};
bufferlist outbl;
bufferlist in_data;
size_t chunk_ofs{0};
@@ -103,11 +111,14 @@ public:
}
void set_in_cb(RGWGetDataCB *_cb) { cb = _cb; }
+ void set_write_drain_cb(RGWWriteDrainCB *_cb) { write_drain_cb = _cb; }
void add_send_data(bufferlist& bl);
void set_stream_write(bool s);
+ uint64_t get_pending_send_size();
+
/* finish streaming writes */
void finish_write();
};