#pragma once #include #include #include #include namespace DB { class TemporaryFileOnDisk; using TemporaryFileOnDiskHolder = std::unique_ptr; /// Rereadable WriteBuffer, could be used as disk buffer /// Creates unique temporary in directory (and directory itself) class WriteBufferFromTemporaryFile : public WriteBufferFromFile, public IReadableWriteBuffer { public: explicit WriteBufferFromTemporaryFile(TemporaryFileOnDiskHolder && tmp_file_); ~WriteBufferFromTemporaryFile() override; private: std::unique_ptr getReadBufferImpl() override; TemporaryFileOnDiskHolder tmp_file; friend class ReadBufferFromTemporaryWriteBuffer; }; }