Block compressor that uses the LZO algorithm. More...
#include <BlockCompressionCodecLzo.h>
Public Member Functions | |
BlockCompressionCodecLzo (const Args &args) | |
Constructor. More... | |
virtual | ~BlockCompressionCodecLzo () |
Destructor. More... | |
virtual void | deflate (const DynamicBuffer &input, DynamicBuffer &output, BlockHeader &header, size_t reserve=0) |
Compresses a buffer using the LZO algorithm. More... | |
virtual void | inflate (const DynamicBuffer &input, DynamicBuffer &output, BlockHeader &header) |
Decompresses a buffer compressed with the LZO algorithm. More... | |
virtual int | get_type () |
Returns enum value representing compression type LZO. More... | |
Public Member Functions inherited from Hypertable::BlockCompressionCodec | |
virtual | ~BlockCompressionCodec () |
Destructor. More... | |
virtual void | set_args (const Args &args) |
Sets arguments to control compression behavior. More... | |
Private Attributes | |
std::unique_ptr< uint8_t[]> | m_workmem |
Working memory buffer used by deflate() and inflate() More... | |
Additional Inherited Members | |
Public Types inherited from Hypertable::BlockCompressionCodec | |
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... | |
Static Public Member Functions inherited from Hypertable::BlockCompressionCodec | |
static const char * | get_compressor_name (uint16_t algo) |
Returns string mnemonic for compression type. More... | |
Block compressor that uses the LZO algorithm.
This class provides a way to compress and decompress blocks of data using the Lempel–Ziv–Oberhumer (lzo) algorithm, a general purpose, dictionary-based compression algorithm that focuses on decompression speed.
Definition at line 44 of file BlockCompressionCodecLzo.h.
BlockCompressionCodecLzo::BlockCompressionCodecLzo | ( | const Args & | args | ) |
Constructor.
Calls lzo_init(), allocates and initializes m_workmem, and passes args
to the default implementation of set_args() since it does not support any arguments.
args | Arguments to control compression behavior (unused) |
Exception | Code set to Error::BLOCK_COMPRESSOR_INVALID_ARG |
Definition at line 45 of file BlockCompressionCodecLzo.cc.
|
virtual |
Destructor.
Definition at line 55 of file BlockCompressionCodecLzo.cc.
|
virtual |
Compresses a buffer using the LZO algorithm.
This method reserves enough space in output
to hold the serialized header
followed by the compressed input followed by reserve
bytes. If the resulting compressed buffer is larger than the input buffer, then the input buffer is copied directly to the output buffer and the compression type is set to BlockCompressionCodec::NONE. Before serailizing header
, the data_length, data_zlength, data_checksum, and compression_type fields are set appropriately. The output buffer is formatted as follows:
header | compressed data | reserve |
input | Input buffer |
output | Output buffer |
header | Block header populated by function |
reserve | Additional space to reserve at end of output buffer |
Implements Hypertable::BlockCompressionCodec.
Definition at line 64 of file BlockCompressionCodecLzo.cc.
|
inlinevirtual |
Returns enum value representing compression type LZO.
Returns the enum value LZO
Implements Hypertable::BlockCompressionCodec.
Definition at line 94 of file BlockCompressionCodecLzo.h.
|
virtual |
Decompresses a buffer compressed with the LZO algorithm.
input | Input buffer |
output | Output buffer |
header | Block header |
Implements Hypertable::BlockCompressionCodec.
Definition at line 110 of file BlockCompressionCodecLzo.cc.
|
private |
Working memory buffer used by deflate() and inflate()
Definition at line 99 of file BlockCompressionCodecLzo.h.