diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2023-12-04 15:32:14 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2023-12-05 01:22:50 +0300 |
commit | c21ed9eedf73010bc81342518177dfdfb0d56bd7 (patch) | |
tree | 72f8fde4463080cfe5a38eb0babc051cfe32c51e /library/cpp/streams | |
parent | ec1311bf2e8cc231723b8b5e484ca576663a1309 (diff) | |
download | ydb-c21ed9eedf73010bc81342518177dfdfb0d56bd7.tar.gz |
Intermediate changes
Diffstat (limited to 'library/cpp/streams')
3 files changed, 0 insertions, 74 deletions
diff --git a/library/cpp/streams/growing_file_input/growing_file_input.cpp b/library/cpp/streams/growing_file_input/growing_file_input.cpp deleted file mode 100644 index 0bbfa5ade9..0000000000 --- a/library/cpp/streams/growing_file_input/growing_file_input.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "growing_file_input.h" - -#include <util/datetime/base.h> -#include <util/generic/yexception.h> - -TGrowingFileInput::TGrowingFileInput(const TString& path) - : File_(path, OpenExisting | RdOnly | Seq) -{ - if (!File_.IsOpen()) { - ythrow TIoException() << "file " << path << " not open"; - } - - File_.Seek(0, sEnd); -} - -TGrowingFileInput::TGrowingFileInput(const TFile& file) - : File_(file) -{ - if (!File_.IsOpen()) { - ythrow TIoException() << "file (" << file.GetName() << ") not open"; - } - - File_.Seek(0, sEnd); -} - -size_t TGrowingFileInput::DoRead(void* buf, size_t len) { - for (int sleepTime = 1;;) { - size_t rr = File_.Read(buf, len); - - if (rr != 0) { - return rr; - } - - NanoSleep((ui64)sleepTime * 1000000); - - if (sleepTime < 2000) { - sleepTime <<= 1; - } - } -} diff --git a/library/cpp/streams/growing_file_input/growing_file_input.h b/library/cpp/streams/growing_file_input/growing_file_input.h deleted file mode 100644 index 9054a5f3da..0000000000 --- a/library/cpp/streams/growing_file_input/growing_file_input.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include <util/stream/input.h> -#include <util/system/file.h> - -/** - * Growing file input stream. - * - * File descriptor offsets to the end of the file, when the object is created. - * - * Read function waites for reading at least one byte. - */ -class TGrowingFileInput: public IInputStream { -public: - TGrowingFileInput(const TFile& file); - TGrowingFileInput(const TString& path); - -private: - size_t DoRead(void* buf, size_t len) override; - -private: - TFile File_; -}; diff --git a/library/cpp/streams/growing_file_input/ya.make b/library/cpp/streams/growing_file_input/ya.make deleted file mode 100644 index 69c56fea46..0000000000 --- a/library/cpp/streams/growing_file_input/ya.make +++ /dev/null @@ -1,11 +0,0 @@ -LIBRARY() - -SRCS( - growing_file_input.cpp -) - -END() - -RECURSE_FOR_TESTS( - ut -) |