]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_compression.h
update sources to v12.1.1
[ceph.git] / ceph / src / rgw / rgw_compression.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_RGW_COMPRESSION_H
5 #define CEPH_RGW_COMPRESSION_H
6
7 #include <vector>
8
9 #include "compressor/Compressor.h"
10 #include "rgw_op.h"
11
12 class RGWGetObj_Decompress : public RGWGetObj_Filter
13 {
14 CephContext* cct;
15 CompressorRef compressor;
16 RGWCompressionInfo* cs_info;
17 bool partial_content;
18 vector<compression_block>::iterator first_block, last_block;
19 off_t q_ofs, q_len;
20 uint64_t cur_ofs;
21 bufferlist waiting;
22 public:
23 RGWGetObj_Decompress(CephContext* cct_,
24 RGWCompressionInfo* cs_info_,
25 bool partial_content_,
26 RGWGetDataCB* next);
27 ~RGWGetObj_Decompress() override {}
28
29 int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override;
30 int fixup_range(off_t& ofs, off_t& end) override;
31
32 };
33
34 class RGWPutObj_Compress : public RGWPutObj_Filter
35 {
36 CephContext* cct;
37 bool compressed{false};
38 CompressorRef compressor;
39 std::vector<compression_block> blocks;
40 public:
41 RGWPutObj_Compress(CephContext* cct_, CompressorRef compressor,
42 RGWPutObjDataProcessor* next)
43 : RGWPutObj_Filter(next), cct(cct_), compressor(compressor) {}
44 ~RGWPutObj_Compress() override{}
45 int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again) override;
46
47 bool is_compressed() { return compressed; }
48 vector<compression_block>& get_compression_blocks() { return blocks; }
49
50 }; /* RGWPutObj_Compress */
51
52 #endif /* CEPH_RGW_COMPRESSION_H */