X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fcompressor%2FCompressor.h;fp=src%2Fceph%2Fsrc%2Fcompressor%2FCompressor.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=dba8f3460fea915c2ca06d851f7c719de310bb1f;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/compressor/Compressor.h b/src/ceph/src/compressor/Compressor.h deleted file mode 100644 index dba8f34..0000000 --- a/src/ceph/src/compressor/Compressor.h +++ /dev/null @@ -1,80 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2015 Haomai Wang - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#ifndef CEPH_COMPRESSOR_H -#define CEPH_COMPRESSOR_H - - -#include -#include -#include -#include "include/assert.h" // boost clobbers this -#include "include/buffer.h" -#include "include/int_types.h" - -class Compressor; -typedef std::shared_ptr CompressorRef; -class CephContext; - -class Compressor { -public: - enum CompressionAlgorithm { - COMP_ALG_NONE = 0, - COMP_ALG_SNAPPY = 1, - COMP_ALG_ZLIB = 2, - COMP_ALG_ZSTD = 3, -#ifdef HAVE_LZ4 - COMP_ALG_LZ4 = 4, -#endif - COMP_ALG_LAST //the last value for range checks - }; - // compression options - enum CompressionMode { - COMP_NONE, ///< compress never - COMP_PASSIVE, ///< compress if hinted COMPRESSIBLE - COMP_AGGRESSIVE, ///< compress unless hinted INCOMPRESSIBLE - COMP_FORCE ///< compress always - }; - - static const char * get_comp_alg_name(int a); - static boost::optional get_comp_alg_type(const std::string &s); - - static const char *get_comp_mode_name(int m); - static boost::optional get_comp_mode_type(const std::string &s); - - Compressor(CompressionAlgorithm a, const char* t) : alg(a), type(t) { - } - virtual ~Compressor() {} - const std::string& get_type_name() const { - return type; - } - CompressionAlgorithm get_type() const { - return alg; - } - virtual int compress(const ceph::bufferlist &in, ceph::bufferlist &out) = 0; - virtual int decompress(const ceph::bufferlist &in, ceph::bufferlist &out) = 0; - // this is a bit weird but we need non-const iterator to be in - // alignment with decode methods - virtual int decompress(ceph::bufferlist::iterator &p, size_t compressed_len, ceph::bufferlist &out) = 0; - - static CompressorRef create(CephContext *cct, const std::string &type); - static CompressorRef create(CephContext *cct, int alg); - -protected: - CompressionAlgorithm alg; - std::string type; - -}; - -#endif