0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CompressorFactory.cc
Go to the documentation of this file.
1 
22 #include <Common/Compat.h>
23 
24 #include "CompressorFactory.h"
25 
26 #include <Common/Logger.h>
27 
34 
35 #include <boost/algorithm/string.hpp>
36 
37 using namespace Hypertable;
38 using namespace std;
39 using namespace boost;
40 
44  string name;
45 
46  split(args, spec, is_any_of(" \t"), token_compress_on);
47 
48  if (!args.empty()) {
49  name = args.front();
50  args.erase(args.begin());
51  }
52 
53  if (name == "none" || name.empty())
55 
56  if (name == "bmz")
58 
59  if (name == "zlib")
61 
62  if (name == "lzo")
64 
65  if (name == "quicklz")
67 
68  if (name == "snappy")
70 
71  HT_ERRORF("unknown codec type: %s", name.c_str());
73 }
74 
77  const BlockCompressionCodec::Args &args) {
78  switch (type) {
80  return new BlockCompressionCodecBmz(args);
82  return new BlockCompressionCodecNone(args);
84  return new BlockCompressionCodecZlib(args);
86  return new BlockCompressionCodecLzo(args);
88  return new BlockCompressionCodecQuicklz(args);
90  return new BlockCompressionCodecSnappy(args);
91  default:
93  "type: '%d'", (int)type);
94  }
95 }
Boost library.
Definition: Properties.cc:39
Block compressor that uses the LZO algorithm.
STL namespace.
Block compressor that uses the QUICKLZ algorithm.
Type
Enumeration for compression type.
Declarations for BlockCompressionCodecSnappy.
std::vector< String > Args
Compression codec argument vector.
Block compressor that uses the ZLIB algorithm.
Bentley-McIlroy large common substring compression.
static BlockCompressionCodec::Type parse_block_codec_spec(const std::string &spec, BlockCompressionCodec::Args &args)
Given a block codec config string return its type and put config.
Logging routines and macros.
Declarations for BlockCompressionCodecZlib.
Compatibility Macros for C/C++.
Block compressor that uses the SNAPPY algorithm.
Declarations for BlockCompressionCodecQuicklz.
Block compressor that uses the BMZ algorithm.
static BlockCompressionCodec * create_block_codec(BlockCompressionCodec::Type, const BlockCompressionCodec::Args &args=BlockCompressionCodec::Args())
Block compressor that performs no compression.
Hypertable definitions
Declarations for BlockCompressionCodecNone.
#define HT_THROWF(_code_, _fmt_,...)
Definition: Error.h:490
bool split(int flags)
Tests the SPLIT bit of flags
#define HT_ERRORF(msg,...)
Definition: Logger.h:300
Declarations for BlockCompressionCodecLzo.
Declarations for BlockCompressionCodecBmz.
Abstract base class for block compression codecs.