mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
#include <Core/Defines.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class ReadBuffer;
|
|
class WriteBuffer;
|
|
|
|
/** These are "generally recognizable" compression methods for data import/export.
|
|
* Do not mess with more efficient compression methods used by ClickHouse internally
|
|
* (they use non-standard framing, indexes, checksums...)
|
|
*/
|
|
|
|
enum class CompressionMethod
|
|
{
|
|
None,
|
|
/// DEFLATE compression with gzip header and CRC32 checksum.
|
|
/// This option corresponds to files produced by gzip(1) or HTTP Content-Encoding: gzip.
|
|
Gzip,
|
|
/// DEFLATE compression with zlib header and Adler32 checksum.
|
|
/// This option corresponds to HTTP Content-Encoding: deflate.
|
|
Zlib,
|
|
Brotli
|
|
};
|
|
|
|
/// How the compression method is named in HTTP.
|
|
std::string toContentEncodingName(CompressionMethod method);
|
|
|
|
/** Choose compression method from path and hint.
|
|
* if hint is "auto" or empty string, then path is analyzed,
|
|
* otherwise path parameter is ignored and hint is used as compression method name.
|
|
* path is arbitrary string that will be analyzed for file extension (gz, br...) that determines compression.
|
|
*/
|
|
CompressionMethod chooseCompressionMethod(const std::string & path, const std::string & hint);
|
|
|
|
std::unique_ptr<ReadBuffer> wrapReadBufferWithCompressionMethod(
|
|
std::unique_ptr<ReadBuffer> nested,
|
|
CompressionMethod method,
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
|
char * existing_memory = nullptr,
|
|
size_t alignment = 0);
|
|
|
|
std::unique_ptr<WriteBuffer> wrapWriteBufferWithCompressionMethod(
|
|
std::unique_ptr<WriteBuffer> nested,
|
|
CompressionMethod method,
|
|
int level,
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
|
char * existing_memory = nullptr,
|
|
size_t alignment = 0);
|
|
|
|
}
|