| 105 | |
| 106 | |
| 107 | std::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 | |
| 135 | std::unique_ptr<WriteBuffer> wrapWriteBufferWithCompressionMethod( |
no test coverage detected