ClickHouse/src/IO/WriteBufferFromTemporaryFile.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
824 B
C++
Raw Normal View History

2020-10-10 18:37:02 +00:00
#pragma once
#include <IO/WriteBuffer.h>
#include <IO/IReadableWriteBuffer.h>
#include <IO/WriteBufferFromFile.h>
2019-10-01 18:51:33 +00:00
#include <Common/filesystemHelpers.h>
namespace DB
{
/// Rereadable WriteBuffer, could be used as disk buffer
/// Creates unique temporary in directory (and directory itself)
class WriteBufferFromTemporaryFile : public WriteBufferFromFile, public IReadableWriteBuffer
{
public:
using Ptr = std::shared_ptr<WriteBufferFromTemporaryFile>;
static Ptr create(const std::string & tmp_dir);
~WriteBufferFromTemporaryFile() override;
2021-11-10 22:58:56 +00:00
private:
explicit WriteBufferFromTemporaryFile(std::unique_ptr<TemporaryFile> && tmp_file);
std::shared_ptr<ReadBuffer> getReadBufferImpl() override;
2019-10-01 18:51:33 +00:00
std::unique_ptr<TemporaryFile> tmp_file;
friend class ReadBufferFromTemporaryWriteBuffer;
};
}