MySQL  8.0.18
Source Code Documentation
compression.h
Go to the documentation of this file.
1 /* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef COMPRESSION_INCLUDED
24 #define COMPRESSION_INCLUDED
25 
26 /**
27  @file include/compression.h
28 */
29 
30 #include <sstream>
31 #include <string>
32 #include <vector>
33 #include "my_inttypes.h"
34 #include "mysql_com.h"
35 
36 #define COMPRESSION_ALGORITHM_ZLIB "zlib"
37 #define COMPRESSION_ALGORITHM_ZSTD "zstd"
38 #define COMPRESSION_ALGORITHM_UNCOMPRESSED "uncompressed"
39 #define COMPRESSION_ALGORITHM_NAME_LENGTH_MAX 32
40 #define COMPRESSION_ALGORITHM_COUNT_MAX 3
41 #define COMPRESSION_ALGORITHM_NAME_BUFFER_SIZE \
42  ((COMPRESSION_ALGORITHM_NAME_LENGTH_MAX * COMPRESSION_ALGORITHM_COUNT_MAX) + \
43  3)
44 #define PROTOCOL_COMPRESSION_DEFAULT_VALUE "zlib,zstd,uncompressed"
45 
47 
48 /* Helper functions to validate compression algorithm and level */
50  std::string name = std::string());
53  std::vector<std::string> &list);
55 bool validate_compression_attributes(std::string algorithm_names,
56  std::string channel_name,
57  bool ignore_errors);
58 
59 #endif /* COMPRESSION_INCLUDED */
bool is_zstd_compression_level_valid(uint level)
This function is used to validate compression level for zstd compression.
Definition: compression.cc:77
const string name("\ame\)
Some integer typedefs for easier portability.
class udf_list * list
enum_compression_algorithm
Definition: my_compress.h:27
constexpr int default_zstd_compression_level
Definition: compression.h:46
void parse_compression_algorithms_list(std::string name, std::vector< std::string > &list)
This function is used to parse comma separated list of compression algorithm names and return a list ...
Definition: compression.cc:62
Common definition between mysql server & client.
std::string get_compression_algorithm_name(enum_compression_algorithm)
bool validate_compression_attributes(std::string algorithm_names, std::string channel_name, bool ignore_errors)
This function is used to validate compression algorithm names and maximum names is not more than 3...
Definition: compression.cc:93
unsigned int uint
Definition: uca-dump.cc:29
static bool ignore_errors
Definition: mysqlcheck.cc:59
enum_compression_algorithm get_compression_algorithm(std::string name=std::string())
This function is used to validate compression algorithm specified as part of change master to stateme...
Definition: compression.cc:38