MySQL  8.0.20
Source Code Documentation
Compression Struct Reference

Compression algorithm. More...

#include <file.h>

Classes

struct  meta_t
 Compressed page meta-data. More...
 

Public Types

enum  Type { NONE = 0, ZLIB = 1, LZ4 = 2 }
 Algorithm types supported. More...
 

Public Member Functions

 Compression ()
 Default constructor. More...
 
 Compression (Type type)
 Specific constructor. More...
 
std::string to_string () const
 

Static Public Member Functions

static bool is_compressed_page (const byte *page)
 Check the page header type field. More...
 
static dberr_t check (const char *algorithm, Compression *compression)
 Check wether the compression algorithm is supported. More...
 
static dberr_t validate (const char *algorithm)
 Validate the algorithm string. More...
 
static const char * to_string (Type type)
 Convert to a "string". More...
 
static std::string to_string (const meta_t &meta)
 Convert the meta data to a std::string. More...
 
static void deserialize_header (const byte *page, meta_t *control)
 Deserizlise the page header compression meta-data. More...
 
static bool is_none (const char *algorithm)
 Check if the string is "empty" or "none". More...
 
static dberr_t deserialize (bool dblwr_read, byte *src, byte *dst, ulint dst_len)
 Decompress the page data contents. More...
 

Public Attributes

Type m_type
 Compression type. More...
 

Detailed Description

Compression algorithm.

Member Enumeration Documentation

◆ Type

Algorithm types supported.

Enumerator
NONE 

No compression.

ZLIB 

Use ZLib.

LZ4 

Use LZ4 faster variant, usually lower compression.

Constructor & Destructor Documentation

◆ Compression() [1/2]

Compression::Compression ( )
inline

Default constructor.

◆ Compression() [2/2]

Compression::Compression ( Type  type)
inlineexplicit

Specific constructor.

Parameters
[in]typeAlgorithm type

Member Function Documentation

◆ check()

dberr_t Compression::check ( const char *  algorithm,
Compression compression 
)
static

Check wether the compression algorithm is supported.

Check for supported COMPRESS := (ZLIB | LZ4 | NONE) supported values.

Parameters
[in]algorithmCompression algorithm to check
[out]compressionThe type that algorithm maps to
Returns
DB_SUCCESS or error code
Parameters
[in]algorithmName of the compression algorithm
[out]compressionThe compression algorithm
Returns
DB_SUCCESS or DB_UNSUPPORTED

◆ deserialize()

dberr_t Compression::deserialize ( bool  dblwr_read,
byte src,
byte dst,
ulint  dst_len 
)
static

Decompress the page data contents.

Page type must be FIL_PAGE_COMPRESSED, if not then the source contents are left unchanged and DB_SUCCESS is returned.

Parameters
[in]dblwr_readtrue if double write recovery in progress
[in,out]srcData read from disk, decompressed data will be copied to this page
[in,out]dstScratch area to use for decompression
[in]dst_lenSize of the scratch area in bytes
Returns
DB_SUCCESS or error code

Page type must be FIL_PAGE_COMPRESSED, if not then the source contents are left unchanged and DB_SUCCESS is returned.

Parameters
[in]dblwr_readtrue of double write recovery in progress
[in,out]srcData read from disk, decompressed data will be copied to this page
[in,out]dstScratch area to use for decompression
[in]dst_lenSize of the scratch area in bytes
Returns
DB_SUCCESS or error code

◆ deserialize_header()

void Compression::deserialize_header ( const byte page,
Compression::meta_t control 
)
static

Deserizlise the page header compression meta-data.

Parameters
[in]pagePointer to the page header
[out]controlDeserialised data

◆ is_compressed_page()

bool Compression::is_compressed_page ( const byte page)
static

Check the page header type field.

Parameters
[in]pagePage contents
Returns
true if it is a compressed page
true if it is a compressed page

◆ is_none()

bool Compression::is_none ( const char *  algorithm)
static

Check if the string is "empty" or "none".

Parameters
[in]algorithmCompression algorithm to check
Returns
true if no algorithm requested

◆ to_string() [1/3]

std::string Compression::to_string ( ) const
inline
Returns
string representation.

◆ to_string() [2/3]

const char * Compression::to_string ( Type  type)
static

Convert to a "string".

NOTE: The functions in this file should only use functions from other files in library.

Parameters
[in]typeThe compression type
Returns
the string representation

The code in this file is used to make a library for external tools.

Parameters
[in]typeThe compression type
Returns
the string representation

◆ to_string() [3/3]

std::string Compression::to_string ( const meta_t meta)
static

Convert the meta data to a std::string.

Parameters
[in]metaPage Meta data
Returns
the string representation

◆ validate()

dberr_t Compression::validate ( const char *  algorithm)
static

Validate the algorithm string.

Check for supported COMPRESS := (ZLIB | LZ4 | NONE) supported values.

Parameters
[in]algorithmCompression algorithm to check
Returns
DB_SUCCESS or error code
Parameters
[in]algorithmName of the compression algorithm
Returns
DB_SUCCESS or DB_UNSUPPORTED

Member Data Documentation

◆ m_type

Type Compression::m_type

Compression type.


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