ClickHouse/src/IO/MMapReadBufferFromFile.h

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

41 lines
734 B
C++
Raw Normal View History

2018-06-13 02:52:03 +00:00
#pragma once
#include <Common/CurrentMetrics.h>
#include <IO/MMapReadBufferFromFileDescriptor.h>
namespace CurrentMetrics
{
extern const Metric OpenFileForRead;
}
namespace DB
{
class MMapReadBufferFromFile : public MMapReadBufferFromFileDescriptor
{
public:
MMapReadBufferFromFile(const std::string & file_name_, size_t offset, size_t length_);
2018-06-13 02:52:03 +00:00
/// Map till end of file.
MMapReadBufferFromFile(const std::string & file_name_, size_t offset);
2018-06-13 02:52:03 +00:00
~MMapReadBufferFromFile() override;
void close();
std::string getFileName() const override;
2018-06-13 02:52:03 +00:00
private:
int fd = -1;
std::string file_name;
2018-06-13 02:52:03 +00:00
CurrentMetrics::Increment metric_increment{CurrentMetrics::OpenFileForRead};
void open();
2018-06-13 02:52:03 +00:00
};
}