MySQL  8.0.22
Source Code Documentation
binary_log::transaction::compression::Zstd_comp Class Reference

This class implements a ZSTD compressor. More...

#include <zstd.h>

Inheritance diagram for binary_log::transaction::compression::Zstd_comp:
binary_log::transaction::compression::Compressor binary_log::transaction::compression::Base_compressor_decompressor

Public Member Functions

 Zstd_comp ()
 
 ~Zstd_comp () override
 
void set_compression_level (unsigned int compression_level) override
 Shall set the compression level to be used. More...
 
type compression_type_code () override
 Shall get the compressor type code. More...
 
bool open () override
 Shall open the compressor. More...
 
std::tuple< std::size_t, boolcompress (const unsigned char *data, size_t length) override
 This member function shall compress the buffer provided and put the compressed payload into the output buffer. More...
 
bool close () override
 This member function shall close the compressor. More...
 
- Public Member Functions inherited from binary_log::transaction::compression::Base_compressor_decompressor
 Base_compressor_decompressor ()
 
virtual ~Base_compressor_decompressor ()
 
virtual size_t size ()
 This member function returns the size of the compressed/decompressed data. More...
 
virtual std::size_t capacity ()
 This member function returns the capacity of the buffer. More...
 
virtual bool set_buffer (unsigned char *buffer, std::size_t capacity)
 This member function SHALL set the buffer into which the compressor or decompressor shall write the data after it processes the stream. More...
 
virtual std::tuple< unsigned char *, std::size_t, std::size_t > get_buffer ()
 This member function SHALL return the buffer, the size of its data and its capacity. More...
 
virtual bool reserve (std::size_t bytes)
 This member function expands the buffer by a number of bytes. More...
 

Static Public Attributes

static const unsigned int DEFAULT_COMPRESSION_LEVEL = 3
 The default compression level for this compressor. More...
 

Protected Attributes

ZSTD_CStream * m_ctx {nullptr}
 The ZSTD compression stream context. More...
 
ZSTD_outBuffer m_obuf
 The output buffer. More...
 
unsigned int m_compression_level_current {DEFAULT_COMPRESSION_LEVEL}
 Variable that holds the current compression level used. More...
 
unsigned int m_compression_level_next {DEFAULT_COMPRESSION_LEVEL}
 If we change the compression level while we are doing compression, this establishes the next compression level value that one should use. More...
 
- Protected Attributes inherited from binary_log::transaction::compression::Base_compressor_decompressor
unsigned char * m_buffer {nullptr}
 The pointer to the buffer holding the data to compress/decompress. More...
 
std::size_t m_buffer_capacity {0}
 The buffer capacity. More...
 
unsigned char * m_buffer_cursor {nullptr}
 A cursor over the buffer. More...
 

Private Member Functions

Zstd_compoperator= (const Zstd_comp &rhs)=delete
 
 Zstd_comp (const Zstd_comp &)=delete
 

Detailed Description

This class implements a ZSTD compressor.

Constructor & Destructor Documentation

◆ Zstd_comp() [1/2]

binary_log::transaction::compression::Zstd_comp::Zstd_comp ( const Zstd_comp )
privatedelete

◆ Zstd_comp() [2/2]

binary_log::transaction::compression::Zstd_comp::Zstd_comp ( )

◆ ~Zstd_comp()

binary_log::transaction::compression::Zstd_comp::~Zstd_comp ( )
override

Member Function Documentation

◆ close()

bool binary_log::transaction::compression::Zstd_comp::close ( )
overridevirtual

This member function shall close the compressor.

It must be called after this compressor is not needed anymore. It shall free the resources it has used for the compression activities.

Returns
false on success, true otherwise.

Implements binary_log::transaction::compression::Base_compressor_decompressor.

◆ compress()

std::tuple< std::size_t, bool > binary_log::transaction::compression::Zstd_comp::compress ( const unsigned char *  data,
size_t  length 
)
overridevirtual

This member function shall compress the buffer provided and put the compressed payload into the output buffer.

Parameters
dataa pointer to the buffer holding the data to compress
lengththe size of the data to compress.
Returns
false on success, true otherwise.

Implements binary_log::transaction::compression::Compressor.

◆ compression_type_code()

type binary_log::transaction::compression::Zstd_comp::compression_type_code ( )
overridevirtual

Shall get the compressor type code.

Returns
the compressor type code.

Implements binary_log::transaction::compression::Base_compressor_decompressor.

◆ open()

bool binary_log::transaction::compression::Zstd_comp::open ( )
overridevirtual

Shall open the compressor.

This member function must be called before compressing data.

Returns
false on success, true otherwise.

Implements binary_log::transaction::compression::Base_compressor_decompressor.

◆ operator=()

Zstd_comp& binary_log::transaction::compression::Zstd_comp::operator= ( const Zstd_comp rhs)
privatedelete

◆ set_compression_level()

void binary_log::transaction::compression::Zstd_comp::set_compression_level ( unsigned int  compression_level)
overridevirtual

Shall set the compression level to be used.

Implements binary_log::transaction::compression::Compressor.

Member Data Documentation

◆ DEFAULT_COMPRESSION_LEVEL

const unsigned int binary_log::transaction::compression::Zstd_comp::DEFAULT_COMPRESSION_LEVEL = 3
static

The default compression level for this compressor.

◆ m_compression_level_current

unsigned int binary_log::transaction::compression::Zstd_comp::m_compression_level_current {DEFAULT_COMPRESSION_LEVEL}
protected

Variable that holds the current compression level used.

◆ m_compression_level_next

unsigned int binary_log::transaction::compression::Zstd_comp::m_compression_level_next {DEFAULT_COMPRESSION_LEVEL}
protected

If we change the compression level while we are doing compression, this establishes the next compression level value that one should use.

◆ m_ctx

ZSTD_CStream* binary_log::transaction::compression::Zstd_comp::m_ctx {nullptr}
protected

The ZSTD compression stream context.

◆ m_obuf

ZSTD_outBuffer binary_log::transaction::compression::Zstd_comp::m_obuf
protected

The output buffer.


The documentation for this class was generated from the following files: