2021-03-26 23:22:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IO/ReadBufferFromFileBase.h>
|
2021-03-28 19:24:28 +00:00
|
|
|
#include <IO/MMappedFileCache.h>
|
2021-03-26 23:22:51 +00:00
|
|
|
#include <IO/MMapReadBufferFromFileDescriptor.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class MMapReadBufferFromFileWithCache : public ReadBufferFromFileBase
|
|
|
|
{
|
|
|
|
public:
|
2021-03-28 19:24:28 +00:00
|
|
|
MMapReadBufferFromFileWithCache(MMappedFileCache & cache, const std::string & file_name, size_t offset, size_t length);
|
2021-03-26 23:22:51 +00:00
|
|
|
|
|
|
|
/// Map till end of file.
|
2021-03-28 19:24:28 +00:00
|
|
|
MMapReadBufferFromFileWithCache(MMappedFileCache & cache, const std::string & file_name, size_t offset);
|
2021-03-26 23:22:51 +00:00
|
|
|
|
|
|
|
off_t getPosition() override;
|
|
|
|
std::string getFileName() const override;
|
|
|
|
off_t seek(off_t offset, int whence) override;
|
|
|
|
|
|
|
|
private:
|
2021-03-28 19:24:28 +00:00
|
|
|
MMappedFileCache::MappedPtr mapped;
|
2021-03-26 23:22:51 +00:00
|
|
|
|
|
|
|
void init();
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|