mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Addition to prev. revision [#METR-9578].
This commit is contained in:
parent
5d7fb8ecce
commit
af3d957de1
@ -16,8 +16,9 @@ private:
|
||||
std::string file_name;
|
||||
|
||||
public:
|
||||
ReadBufferFromFile(const std::string & file_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, char * existing_memory = NULL)
|
||||
: ReadBufferFromFileDescriptor(-1, buf_size, existing_memory), file_name(file_name_)
|
||||
ReadBufferFromFile(const std::string & file_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
||||
char * existing_memory = NULL, size_t alignment = 0)
|
||||
: ReadBufferFromFileDescriptor(-1, buf_size, existing_memory, alignment), file_name(file_name_)
|
||||
{
|
||||
fd = open(file_name.c_str(), O_RDONLY);
|
||||
|
||||
|
@ -55,8 +55,8 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
ReadBufferFromFileDescriptor(int fd_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, char * existing_memory = NULL)
|
||||
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory), fd(fd_), pos_in_file(0) {}
|
||||
ReadBufferFromFileDescriptor(int fd_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, char * existing_memory = NULL, size_t alignment = 0)
|
||||
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment), fd(fd_), pos_in_file(0) {}
|
||||
|
||||
int getFD()
|
||||
{
|
||||
|
@ -18,8 +18,9 @@ private:
|
||||
std::string file_name;
|
||||
|
||||
public:
|
||||
WriteBufferFromFile(const std::string & file_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, int flags = -1, mode_t mode = 0666)
|
||||
: WriteBufferFromFileDescriptor(-1, buf_size), file_name(file_name_)
|
||||
WriteBufferFromFile(const std::string & file_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, int flags = -1, mode_t mode = 0666,
|
||||
char * existing_memory = NULL, size_t alignment = 0)
|
||||
: WriteBufferFromFileDescriptor(-1, buf_size, existing_memory, alignment), file_name(file_name_)
|
||||
{
|
||||
fd = open(file_name.c_str(), flags == -1 ? O_WRONLY | O_TRUNC | O_CREAT : flags, mode);
|
||||
|
||||
|
@ -46,8 +46,8 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
WriteBufferFromFileDescriptor(int fd_ = -1, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, size_t alignment = 0)
|
||||
: BufferWithOwnMemory<WriteBuffer>(buf_size, NULL, alignment), fd(fd_) {}
|
||||
WriteBufferFromFileDescriptor(int fd_ = -1, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, char * existing_memory = NULL, size_t alignment = 0)
|
||||
: BufferWithOwnMemory<WriteBuffer>(buf_size, existing_memory, alignment), fd(fd_) {}
|
||||
|
||||
/** Можно вызывать для инициализации, если нужный fd не был передан в конструктор.
|
||||
* Менять fd во время работы нельзя.
|
||||
|
Loading…
Reference in New Issue
Block a user