1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef ZLIB_COMPRESSION_H 16 #define ZLIB_COMPRESSION_H 17 #ifndef OMIT_ZLIB 18 #include <vector> 19 #include "data_compression.h" 20 21 namespace DistributedDB { 22 class ZlibCompression final : public DataCompression { 23 public: 24 ZlibCompression(); 25 ~ZlibCompression() = default; 26 27 int Compress(const std::vector<uint8_t> &srcData, std::vector<uint8_t> &destData) const override; 28 int Uncompress(const std::vector<uint8_t> &srcData, std::vector<uint8_t> &destData, uint32_t destLen) const 29 override; 30 31 protected: 32 ZlibCompression(const ZlibCompression& compression) = delete; 33 ZlibCompression& operator= (const ZlibCompression& compression) = delete; 34 }; 35 } // namespace DistributedDB 36 #endif // OMIT_ZLIB 37 #endif // ZLIB_COMPRESSION_H