Allows to plug in decompression in future.
Signed-off-by: Adam Kupczyk (a.kupczyk@mirantis.com)
Conflicts:
src/rgw/rgw_op.cc
gc_invalidate_time += (s->cct->_conf->rgw_gc_obj_min_wait / 2);
RGWGetObj_CB cb(this);
-
+ RGWGetDataCB* decrypt = nullptr;
map<string, bufferlist>::iterator attr_iter;
perfcounter->inc(l_rgw_get);
perfcounter->inc(l_rgw_get_b, new_end - new_ofs);
- op_ret = read_op.iterate(new_ofs, new_end, &cb);
+ op_ret = this->get_decrypt_filter(&decrypt, cb);
+ if (op_ret < 0) {
+ goto done_err;
+ }
+ if (decrypt != nullptr) {
+ off_t tmp_ofs = ofs;
+ off_t tmp_end = end;
+ decrypt->fixup_range(tmp_ofs, tmp_end);
+ op_ret = read_op.iterate(tmp_ofs, tmp_end, decrypt);
+ if (op_ret >= 0)
+ op_ret = decrypt->flush();
+ delete decrypt;
+ }
+ else
+ op_ret = read_op.iterate(ofs, end, &cb);
perfcounter->tinc(l_rgw_get_lat,
(ceph_clock_now(s->cct) - start_time));
virtual RGWOpType get_type() { return RGW_OP_GET_OBJ; }
virtual uint32_t op_mask() { return RGW_OP_TYPE_READ; }
virtual bool need_object_expiration() { return false; }
+ /**
+ * calculates filter used to decrypt RGW objects data
+ */
+ virtual int get_decrypt_filter(RGWGetDataCB** filter, RGWGetDataCB& cb) {
+ *filter = NULL;
+ return 0;
+ }
};
class RGWGetObj_CB : public RGWGetDataCB
}
};
+class RGWGetObj_Filter : public RGWGetDataCB
+{
+protected:
+ RGWGetDataCB& next;
+public:
+ RGWGetObj_Filter(RGWGetDataCB& next): next(next) {}
+ virtual ~RGWGetObj_Filter() {}
+ /**
+ * Passes data through filter.
+ * Filter can modify content of bl.
+ * When bl_len == 0 , it means 'flush
+ */
+ virtual int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) {
+ return next.handle_data(bl, bl_ofs, bl_len);
+ }
+ /**
+ * Flushes any cached data. Used by RGWGetObjFilter.
+ * Return logic same as handle_data.
+ */
+ virtual int flush() {
+ return next.flush();
+ }
+ /**
+ * Allows filter to extend range required for successful filtering
+ */
+ virtual void fixup_range(off_t& bl_ofs, off_t& bl_len) {
+ next.fixup_range(bl_ofs, bl_len);
+ }
+};
+
class RGWBulkDelete : public RGWOp {
public:
struct acct_path_t {
virtual void set_extra_data_len(uint64_t len) {
extra_data_len = len;
}
+ /**
+ * Flushes any cached data. Used by RGWGetObjFilter.
+ * Return logic same as handle_data.
+ */
+ virtual int flush() {
+ return 0;
+ }
+ /**
+ * Allows to extend fetch range of RGW object. Used by RGWGetObjFilter.
+ */
+ virtual void fixup_range(off_t& bl_ofs, off_t& bl_end) {}
};
class RGWAccessListFilter {
-Subproject commit 9322c258084c6abdeefe00067f8b310a6e0d9a5a
+Subproject commit c02b179490123a3212b0c0d23b69da13965d1552
-Subproject commit 1f40c6511fa8dd9d2e337ca8c9bc18b3e87663c9
+Subproject commit 44a6297b298e59ab7452defe859f21ed8371aa1c