mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 11:52:27 +00:00
25 lines
648 B
C++
25 lines
648 B
C++
#pragma once
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
#include <IO/ReadBufferFromFileBase.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// In case of empty file it does not make any sense to read it.
|
|
///
|
|
/// Plus regular readers from file has an assert that buffer is not empty, that will fail:
|
|
/// - ReadBufferFromFileDescriptor
|
|
/// - SynchronousReader
|
|
/// - ThreadPoolReader
|
|
class ReadBufferFromEmptyFile : public ReadBufferFromFileBase
|
|
{
|
|
private:
|
|
bool nextImpl() override { return false; }
|
|
std::string getFileName() const override { return "<empty>"; }
|
|
off_t seek(off_t /*off*/, int /*whence*/) override { return 0; }
|
|
off_t getPosition() override { return 0; }
|
|
};
|
|
|
|
}
|