mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 03:42:48 +00:00
31 lines
765 B
C++
31 lines
765 B
C++
#pragma once
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class SeekableReadBuffer : public ReadBuffer
|
|
{
|
|
public:
|
|
SeekableReadBuffer(Position ptr, size_t size)
|
|
: ReadBuffer(ptr, size) {}
|
|
SeekableReadBuffer(Position ptr, size_t size, size_t offset)
|
|
: ReadBuffer(ptr, size, offset) {}
|
|
|
|
/**
|
|
* Shifts buffer current position to given offset.
|
|
* @param off Offset.
|
|
* @param whence Seek mode (@see SEEK_SET, @see SEEK_CUR).
|
|
* @return New position from the begging of underlying buffer / file.
|
|
*/
|
|
virtual off_t seek(off_t off, int whence) = 0;
|
|
|
|
/**
|
|
* @return Offset from the begin of the underlying buffer / file corresponds to the buffer current position.
|
|
*/
|
|
virtual off_t getPosition() = 0;
|
|
};
|
|
|
|
}
|