summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_cr_rest.h
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@redhat.com>2017-10-03 02:26:57 +0200
committerYehuda Sadeh <yehuda@redhat.com>2018-04-10 17:05:38 +0200
commitbbab9e5af0c3b53eb3824c26c785a23708b02072 (patch)
tree0a9a9c7271add129f2f5d9eff1c28026f4768c33 /src/rgw/rgw_cr_rest.h
parentrgw: separte stream crfs for read and write (diff)
downloadceph-bbab9e5af0c3b53eb3824c26c785a23708b02072.tar.xz
ceph-bbab9e5af0c3b53eb3824c26c785a23708b02072.zip
rgw: more streaming crf abstraction
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
Diffstat (limited to 'src/rgw/rgw_cr_rest.h')
-rw-r--r--src/rgw/rgw_cr_rest.h37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/rgw/rgw_cr_rest.h b/src/rgw/rgw_cr_rest.h
index df7c93fbfe4..07296a0a36f 100644
--- a/src/rgw/rgw_cr_rest.h
+++ b/src/rgw/rgw_cr_rest.h
@@ -315,6 +315,8 @@ protected:
public:
virtual int init() = 0;
virtual int read(bufferlist *data, uint64_t max, bool *need_retry) = 0; /* reentrant */
+ virtual bool has_attrs() = 0;
+ virtual void get_attrs(std::map<string, string> *attrs) = 0;
};
class RGWStreamWriteResourceCRF {
@@ -324,6 +326,7 @@ protected:
public:
virtual int init() = 0;
+ virtual void set_attrs(const std::map<string, string>& attrs) = 0;
virtual int write(bufferlist& data) = 0; /* reentrant */
virtual int drain_writes(bool *need_retry) = 0; /* reentrant */
};
@@ -337,6 +340,7 @@ class RGWStreamReadHTTPResourceCRF : public RGWStreamReadResourceCRF {
RGWCRHTTPGetDataCB *in_cb{nullptr};
+ bool got_attrs{false};
public:
RGWStreamReadHTTPResourceCRF(CephContext *_cct,
@@ -349,8 +353,10 @@ public:
req(_req) {}
virtual ~RGWStreamReadHTTPResourceCRF();
- int init();
+ int init() override;
int read(bufferlist *data, uint64_t max, bool *need_retry) override; /* reentrant */
+ bool has_attrs() override;
+ void get_attrs(std::map<string, string> *pattrs) override;
};
class RGWStreamWriteHTTPResourceCRF : public RGWStreamWriteResourceCRF {
@@ -371,28 +377,43 @@ public:
req(_req) {}
virtual ~RGWStreamWriteHTTPResourceCRF() {}
- int init();
- int write(bufferlist& data); /* reentrant */
- int drain_writes(bool *need_retry); /* reentrant */
+ int init() override;
+ void set_attrs(const std::map<string, string>& attrs) override;
+ int write(bufferlist& data) override; /* reentrant */
+ int drain_writes(bool *need_retry) override; /* reentrant */
};
-class TestSpliceCR : public RGWCoroutine {
+class RGWStreamSpliceCR : public RGWCoroutine {
CephContext *cct;
RGWHTTPManager *http_manager;
string url;
- RGWHTTPStreamRWRequest *in_req{nullptr};
- RGWHTTPStreamRWRequest *out_req{nullptr};
RGWStreamReadHTTPResourceCRF *in_crf{nullptr};
RGWStreamWriteHTTPResourceCRF *out_crf{nullptr};
bufferlist bl;
bool need_retry{false};
+ bool sent_attrs{false};
uint64_t total_read{0};
int ret{0};
public:
+ RGWStreamSpliceCR(CephContext *_cct, RGWHTTPManager *_mgr,
+ RGWStreamReadHTTPResourceCRF *_in_crf,
+ RGWStreamWriteHTTPResourceCRF *_out_crf);
+ ~RGWStreamSpliceCR();
+
+ int operate();
+};
+
+class TestSpliceCR : public RGWCoroutine {
+ CephContext *cct;
+ RGWHTTPManager *http_manager;
+ RGWHTTPStreamRWRequest *in_req{nullptr};
+ RGWHTTPStreamRWRequest *out_req{nullptr};
+ RGWStreamReadHTTPResourceCRF *in_crf{nullptr};
+ RGWStreamWriteHTTPResourceCRF *out_crf{nullptr};
+public:
TestSpliceCR(CephContext *_cct, RGWHTTPManager *_mgr,
RGWHTTPStreamRWRequest *_in_req,
RGWHTTPStreamRWRequest *_out_req);
- ~TestSpliceCR();
int operate();
};