Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / compressor / zlib / ZlibCompressor.h
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
20 #include "compressor/Compressor.h"
21
22 class ZlibCompressor : public Compressor {
23   bool isal_enabled;
24   CephContext *const cct;
25 public:
26   ZlibCompressor(CephContext *cct, bool isal)
27     : Compressor(COMP_ALG_ZLIB, "zlib"), isal_enabled(isal), cct(cct) {}
28
29   int compress(const bufferlist &in, bufferlist &out) override;
30   int decompress(const bufferlist &in, bufferlist &out) override;
31   int decompress(bufferlist::iterator &p, size_t compressed_len, bufferlist &out) override;
32 private:
33   int zlib_compress(const bufferlist &in, bufferlist &out);
34   int isal_compress(const bufferlist &in, bufferlist &out);
35  };
36
37
38 #endif