Abstract base class for block compression codecs. More...
#include <BlockCompressionCodec.h>
Public Types | |
enum | Type { UNKNOWN =-1, NONE =0, BMZ =1, ZLIB =2, LZO =3, QUICKLZ =4, SNAPPY =5, COMPRESSION_TYPE_LIMIT =6 } |
Enumeration for compression type. More... | |
typedef std::vector< String > | Args |
Compression codec argument vector. More... | |
Public Member Functions | |
virtual | ~BlockCompressionCodec () |
Destructor. More... | |
virtual void | deflate (const DynamicBuffer &input, DynamicBuffer &output, BlockHeader &header, size_t reserve=0)=0 |
Compresses a buffer. More... | |
virtual void | inflate (const DynamicBuffer &input, DynamicBuffer &output, BlockHeader &header)=0 |
Decompresses a buffer. More... | |
virtual void | set_args (const Args &args) |
Sets arguments to control compression behavior. More... | |
virtual int | get_type ()=0 |
Returns compression type enum. More... | |
Static Public Member Functions | |
static const char * | get_compressor_name (uint16_t algo) |
Returns string mnemonic for compression type. More... | |
Abstract base class for block compression codecs.
Definition at line 47 of file BlockCompressionCodec.h.
typedef std::vector<String> Hypertable::BlockCompressionCodec::Args |
Compression codec argument vector.
Definition at line 63 of file BlockCompressionCodec.h.
|
inlinevirtual |
Destructor.
Definition at line 71 of file BlockCompressionCodec.h.
|
pure virtual |
Compresses a buffer.
input | Input buffer |
output | Output buffer |
header | Block header populated by function |
reserve | Additional space to reserve at end of output |
Implemented in Hypertable::BlockCompressionCodecZlib, Hypertable::BlockCompressionCodecBmz, Hypertable::BlockCompressionCodecLzo, Hypertable::BlockCompressionCodecQuicklz, Hypertable::BlockCompressionCodecSnappy, and Hypertable::BlockCompressionCodecNone.
|
static |
Returns string mnemonic for compression type.
algo | Compression type (see BlockCompressionCodec::Type) |
Definition at line 44 of file BlockCompressionCodec.cc.
|
pure virtual |
Returns compression type enum.
Returns the enum value that represents the compressoion type
Implemented in Hypertable::BlockCompressionCodecBmz, Hypertable::BlockCompressionCodecZlib, Hypertable::BlockCompressionCodecLzo, Hypertable::BlockCompressionCodecQuicklz, Hypertable::BlockCompressionCodecSnappy, and Hypertable::BlockCompressionCodecNone.
|
pure virtual |
Decompresses a buffer.
input | Input buffer |
output | Output buffer |
header | Block header |
Implemented in Hypertable::BlockCompressionCodecZlib, Hypertable::BlockCompressionCodecBmz, Hypertable::BlockCompressionCodecLzo, Hypertable::BlockCompressionCodecQuicklz, Hypertable::BlockCompressionCodecSnappy, and Hypertable::BlockCompressionCodecNone.
|
inlinevirtual |
Sets arguments to control compression behavior.
This method provides a default implementation for derived classes and simply throws an exception for each argument
args | Compressor specific arguments |
Exception | Code set to Error::BLOCK_COMPRESSOR_INVALID_ARG |
Reimplemented in Hypertable::BlockCompressionCodecBmz, and Hypertable::BlockCompressionCodecZlib.
Definition at line 93 of file BlockCompressionCodec.h.