diff options
author | iddqd <iddqd@yandex-team.ru> | 2022-02-10 16:49:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:46 +0300 |
commit | ff241e1daf76d79ed38015cdb76d55eb3a33ac27 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream/direct_io.cpp | |
parent | 07fce9c5f7771600d0b3d70e1f88fd8a7e164d85 (diff) | |
download | ydb-ff241e1daf76d79ed38015cdb76d55eb3a33ac27.tar.gz |
Restoring authorship annotation for <iddqd@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/direct_io.cpp')
-rw-r--r-- | util/stream/direct_io.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/util/stream/direct_io.cpp b/util/stream/direct_io.cpp index 5aab0830e1..649033af34 100644 --- a/util/stream/direct_io.cpp +++ b/util/stream/direct_io.cpp @@ -1,47 +1,47 @@ -#include "direct_io.h" - +#include "direct_io.h" + #include <util/generic/utility.h> -size_t TRandomAccessFileInput::DoRead(void* buf, size_t len) { - const size_t result = File.Pread(buf, len, Position); - Position += result; - return result; -} - -TRandomAccessFileInput::TRandomAccessFileInput(TDirectIOBufferedFile& file, ui64 position) - : File(file) - , Position(position) -{ -} - -size_t TRandomAccessFileInput::DoSkip(size_t len) { +size_t TRandomAccessFileInput::DoRead(void* buf, size_t len) { + const size_t result = File.Pread(buf, len, Position); + Position += result; + return result; +} + +TRandomAccessFileInput::TRandomAccessFileInput(TDirectIOBufferedFile& file, ui64 position) + : File(file) + , Position(position) +{ +} + +size_t TRandomAccessFileInput::DoSkip(size_t len) { size_t skiped = Min(len, (size_t)Min((ui64)Max<size_t>(), File.GetLength() - Position)); - Position += skiped; - return skiped; -} - -TRandomAccessFileOutput::TRandomAccessFileOutput(TDirectIOBufferedFile& file) + Position += skiped; + return skiped; +} + +TRandomAccessFileOutput::TRandomAccessFileOutput(TDirectIOBufferedFile& file) : File(&file) -{ -} - -void TRandomAccessFileOutput::DoWrite(const void* buf, size_t len) { +{ +} + +void TRandomAccessFileOutput::DoWrite(const void* buf, size_t len) { File->Write(buf, len); -} - -void TRandomAccessFileOutput::DoFlush() { +} + +void TRandomAccessFileOutput::DoFlush() { File->FlushData(); -} - +} + TBufferedFileOutputEx::TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen) - : TRandomAccessFileOutput(*(new TDirectIOBufferedFile(path, oMode, buflen))) + : TRandomAccessFileOutput(*(new TDirectIOBufferedFile(path, oMode, buflen))) , FileHolder(File) -{ -} - -void TBufferedFileOutputEx::DoFinish() { - FileHolder->Finish(); -} - -void TBufferedFileOutputEx::DoFlush() { -} +{ +} + +void TBufferedFileOutputEx::DoFinish() { + FileHolder->Finish(); +} + +void TBufferedFileOutputEx::DoFlush() { +} |