mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
78fc36ca49
This makes the target location consistent with other auto-generated files like config_formats.h, config_core.h, and config_functions.h and simplifies the build of clickhouse_common.
42 lines
811 B
C++
42 lines
811 B
C++
#pragma once
|
|
|
|
#include "config.h"
|
|
|
|
#if USE_SNAPPY
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
#include <IO/WriteBuffer.h>
|
|
|
|
namespace DB
|
|
{
|
|
/// Performs compression using snappy library and write compressed data to the underlying buffer.
|
|
class SnappyWriteBuffer : public BufferWithOwnMemory<WriteBuffer>
|
|
{
|
|
public:
|
|
explicit SnappyWriteBuffer(
|
|
std::unique_ptr<WriteBuffer> out_,
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
|
char * existing_memory = nullptr,
|
|
size_t alignment = 0);
|
|
|
|
~SnappyWriteBuffer() override;
|
|
|
|
void finalizeImpl() override { finish(); }
|
|
|
|
private:
|
|
void nextImpl() override;
|
|
|
|
void finishImpl();
|
|
void finish();
|
|
|
|
std::unique_ptr<WriteBuffer> out;
|
|
bool finished = false;
|
|
|
|
String uncompress_buffer;
|
|
String compress_buffer;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|