ClickHouse/src/IO/BoundedReadBuffer.h

31 lines
623 B
C++
Raw Normal View History

2022-05-25 20:45:31 +00:00
#pragma once
2022-05-25 18:28:46 +00:00
#include <IO/ReadBufferFromFileDecorator.h>
namespace DB
{
class BoundedReadBuffer : public ReadBufferFromFileDecorator
{
public:
explicit BoundedReadBuffer(std::unique_ptr<SeekableReadBuffer> impl_);
bool supportsRightBoundedReads() const override { return true; }
void setReadUntilPosition(size_t position) override;
void setReadUntilEnd() override;
bool nextImpl() override;
off_t seek(off_t off, int whence) override;
2022-05-27 13:10:52 +00:00
Range getRemainingReadRange() const override;
2022-05-25 18:28:46 +00:00
private:
std::optional<size_t> read_until_position;
size_t file_offset_of_buffer_end = 0;
};
}