MySQL 9.1.0
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 : uint8_t { 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 bool is_compressed_encrypted_page (const byte *page)
 Check the page header type field. More...
 
static bool is_valid_page_version (uint8_t version)
 Check if the version on page is valid. More...
 
static dberr_t check (const char *algorithm, Compression *compression)
 Check whether the compression algorithm is supported. More...
 
static dberr_t validate (const char *algorithm)
 Validate the algorithm string. More...
 
static bool validate (const Type type)
 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...
 

Static Public Attributes

static constexpr uint8_t FIL_PAGE_VERSION_1 = 1
 Version of compressed page. More...
 
static constexpr uint8_t FIL_PAGE_VERSION_2 = 2
 

Detailed Description

Compression algorithm.

Member Enumeration Documentation

◆ Type

enum Compression::Type : uint8_t

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 whether the compression algorithm is supported.

Parameters
[in]algorithmCompression algorithm to check
[out]compressionThe type that algorithm maps to
Returns
DB_SUCCESS or error code

◆ 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 or nullptr.
[in]dst_lenIf dst is valid, size 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_encrypted_page()

bool Compression::is_compressed_encrypted_page ( const byte page)
static

Check the page header type field.

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

◆ 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

◆ is_valid_page_version()

bool Compression::is_valid_page_version ( uint8_t  version)
static

Check if the version on page is valid.

Parameters
[in]versionversion
Returns
true if version is valid

◆ to_string() [1/3]

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

◆ to_string() [2/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

◆ to_string() [3/3]

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

Convert to a "string".

Parameters
[in]typeThe compression type
Returns
the string representation

◆ validate() [1/2]

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

Validate the algorithm string.

Parameters
[in]algorithmCompression algorithm to check
Returns
DB_SUCCESS or error code

◆ validate() [2/2]

bool Compression::validate ( const Type  type)
static

Validate the algorithm string.

Parameters
[in]typecompression type
Returns
true if type is valid, else false

Member Data Documentation

◆ FIL_PAGE_VERSION_1

constexpr uint8_t Compression::FIL_PAGE_VERSION_1 = 1
staticconstexpr

Version of compressed page.

◆ FIL_PAGE_VERSION_2

constexpr uint8_t Compression::FIL_PAGE_VERSION_2 = 2
staticconstexpr

◆ m_type

Type Compression::m_type

Compression type.


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