]>
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 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2015 Mirantis, Inc. | |
7 | * | |
8 | * Author: Alyona Kiseleva <akiselyova@mirantis.com> | |
9 | * | |
10 | * This library is free software; you can redistribute it and/or | |
11 | * modify it under the terms of the GNU Lesser General Public | |
12 | * License as published by the Free Software Foundation; either | |
13 | * version 2.1 of the License, or (at your option) any later version. | |
14 | * | |
15 | */ | |
16 | ||
17 | #ifndef CEPH_COMPRESSION_ZLIB_H | |
18 | #define CEPH_COMPRESSION_ZLIB_H | |
19 | ||
11fdf7f2 | 20 | #include "common/config.h" |
7c673cae FG |
21 | #include "compressor/Compressor.h" |
22 | ||
23 | class ZlibCompressor : public Compressor { | |
24 | bool isal_enabled; | |
224ce89b | 25 | CephContext *const cct; |
7c673cae | 26 | public: |
224ce89b | 27 | ZlibCompressor(CephContext *cct, bool isal) |
11fdf7f2 TL |
28 | : Compressor(COMP_ALG_ZLIB, "zlib"), isal_enabled(isal), cct(cct) { |
29 | #ifdef HAVE_QATZIP | |
30 | if (cct->_conf->qat_compressor_enabled && qat_accel.init("zlib")) | |
31 | qat_enabled = true; | |
32 | else | |
33 | qat_enabled = false; | |
34 | #endif | |
35 | } | |
7c673cae | 36 | |
1e59de90 TL |
37 | int compress(const ceph::buffer::list &in, ceph::buffer::list &out, std::optional<int32_t> &compressor_message) override; |
38 | int decompress(const ceph::buffer::list &in, ceph::buffer::list &out, std::optional<int32_t> compressor_message) override; | |
39 | int decompress(ceph::buffer::list::const_iterator &p, size_t compressed_len, ceph::buffer::list &out, std::optional<int32_t> compressor_message) override; | |
7c673cae | 40 | private: |
1e59de90 TL |
41 | int zlib_compress(const ceph::buffer::list &in, ceph::buffer::list &out, std::optional<int32_t> &compressor_message); |
42 | int isal_compress(const ceph::buffer::list &in, ceph::buffer::list &out, std::optional<int32_t> &compressor_message); | |
7c673cae FG |
43 | }; |
44 | ||
45 | ||
46 | #endif |