mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-19 12:52:37 +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.
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "config.h"
|
|
|
|
#if USE_SSL
|
|
#include <IO/ReadBufferFromFileBase.h>
|
|
#include <IO/FileEncryptionCommon.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Reads data from the underlying read buffer and decrypts it.
|
|
class ReadBufferFromEncryptedFile : public ReadBufferFromFileBase
|
|
{
|
|
public:
|
|
ReadBufferFromEncryptedFile(
|
|
size_t buffer_size_,
|
|
std::unique_ptr<ReadBufferFromFileBase> in_,
|
|
const String & key_,
|
|
const FileEncryption::Header & header_,
|
|
size_t offset_ = 0);
|
|
|
|
off_t seek(off_t off, int whence) override;
|
|
off_t getPosition() override;
|
|
|
|
std::string getFileName() const override { return in->getFileName(); }
|
|
|
|
void setReadUntilPosition(size_t position) override { in->setReadUntilPosition(position + FileEncryption::Header::kSize); }
|
|
|
|
void setReadUntilEnd() override { in->setReadUntilEnd(); }
|
|
|
|
size_t getFileSize() override { return in->getFileSize(); }
|
|
|
|
private:
|
|
bool nextImpl() override;
|
|
|
|
std::unique_ptr<ReadBufferFromFileBase> in;
|
|
|
|
off_t offset = 0;
|
|
|
|
bool need_seek = false;
|
|
|
|
Memory<> encrypted_buffer;
|
|
FileEncryption::Encryptor encryptor;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|