]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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" | |
11fdf7f2 | 10 | #include "rgw_putobj.h" |
7c673cae FG |
11 | #include "rgw_op.h" |
12 | ||
13 | class RGWGetObj_Decompress : public RGWGetObj_Filter | |
14 | { | |
15 | CephContext* cct; | |
16 | CompressorRef compressor; | |
17 | RGWCompressionInfo* cs_info; | |
18 | bool partial_content; | |
19 | vector<compression_block>::iterator first_block, last_block; | |
20 | off_t q_ofs, q_len; | |
7c673cae FG |
21 | uint64_t cur_ofs; |
22 | bufferlist waiting; | |
23 | public: | |
24 | RGWGetObj_Decompress(CephContext* cct_, | |
25 | RGWCompressionInfo* cs_info_, | |
26 | bool partial_content_, | |
11fdf7f2 | 27 | RGWGetObj_Filter* next); |
7c673cae FG |
28 | ~RGWGetObj_Decompress() override {} |
29 | ||
30 | int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override; | |
31 | int fixup_range(off_t& ofs, off_t& end) override; | |
32 | ||
33 | }; | |
34 | ||
11fdf7f2 | 35 | class RGWPutObj_Compress : public rgw::putobj::Pipe |
7c673cae FG |
36 | { |
37 | CephContext* cct; | |
38 | bool compressed{false}; | |
39 | CompressorRef compressor; | |
40 | std::vector<compression_block> blocks; | |
41 | public: | |
42 | RGWPutObj_Compress(CephContext* cct_, CompressorRef compressor, | |
11fdf7f2 TL |
43 | rgw::putobj::DataProcessor *next) |
44 | : Pipe(next), cct(cct_), compressor(compressor) {} | |
45 | ||
46 | int process(bufferlist&& data, uint64_t logical_offset) override; | |
7c673cae FG |
47 | |
48 | bool is_compressed() { return compressed; } | |
49 | vector<compression_block>& get_compression_blocks() { return blocks; } | |
50 | ||
51 | }; /* RGWPutObj_Compress */ | |
52 | ||
53 | #endif /* CEPH_RGW_COMPRESSION_H */ |