MCPcopy Create free account
hub / github.com/ByConity/ByConity / wrapReadBufferWithCompressionMethod

Function wrapReadBufferWithCompressionMethod

src/IO/CompressionMethod.cpp:107–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107std::unique_ptr<ReadBuffer> wrapReadBufferWithCompressionMethod(
108 std::unique_ptr<ReadBuffer> nested, CompressionMethod method, const bool snappy_format_blocked, size_t buf_size, char * existing_memory, size_t alignment)
109{
110 if (method == CompressionMethod::Gzip || method == CompressionMethod::Zlib)
111 return std::make_unique<ZlibInflatingReadBuffer>(std::move(nested), method, buf_size, existing_memory, alignment);
112#if USE_BROTLI
113 if (method == CompressionMethod::Brotli)
114 return std::make_unique<BrotliReadBuffer>(std::move(nested), buf_size, existing_memory, alignment);
115#endif
116 if (method == CompressionMethod::Xz)
117 return std::make_unique<LZMAInflatingReadBuffer>(std::move(nested), buf_size, existing_memory, alignment);
118 if (method == CompressionMethod::Zstd)
119 return std::make_unique<ZstdInflatingReadBuffer>(std::move(nested), buf_size, existing_memory, alignment);
120 if (method == CompressionMethod::Snappy)
121 {
122 if (snappy_format_blocked)
123 return std::make_unique<SnappyReadBuffer<true>>(std::move(nested));
124 else
125 return std::make_unique<SnappyReadBuffer<false>>(std::move(nested));
126 }
127
128 if (method == CompressionMethod::None)
129 return nested;
130
131 throw Exception("Unsupported compression method", ErrorCodes::NOT_IMPLEMENTED);
132}
133
134
135std::unique_ptr<WriteBuffer> wrapWriteBufferWithCompressionMethod(

Callers 12

generateMethod · 0.85
initializeMethod · 0.85
nextMethod · 0.85
StorageURLSourceMethod · 0.85
initializeMethod · 0.85
generateMethod · 0.85
ChangelogReaderMethod · 0.85
processQueryMethod · 0.85
createWrappedBufferMethod · 0.85

Calls 1

ExceptionClass · 0.50

Tested by

no test coverage detected