aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/ReadBufferFromEmptyFile.h
blob: f21f2f507dcf61c7aabb53d83290271fb3985f37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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; }
    size_t getFileSize() override { return 0; }
};

}