diff options
author | ionagamed <ionagamed@yandex-team.com> | 2024-04-15 10:18:45 +0300 |
---|---|---|
committer | ionagamed <ionagamed@yandex-team.com> | 2024-04-15 10:28:06 +0300 |
commit | c015541a60f8d93070c53511daaff81db730d194 (patch) | |
tree | 248d7d962c718e75801036109fdef147bc1880ed /library/cpp/yson/parser.cpp | |
parent | 7930380b354abe9969174901a4e8a730ab1d0906 (diff) | |
download | ydb-c015541a60f8d93070c53511daaff81db730d194.tar.gz |
YT: Add NodeFromYsonStreamNonGreedy; use it in TNode::Load
В рамках
3547980204d51d6eba4c3b56989a916379526673
Diffstat (limited to 'library/cpp/yson/parser.cpp')
-rw-r--r-- | library/cpp/yson/parser.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/library/cpp/yson/parser.cpp b/library/cpp/yson/parser.cpp index 783f9b9047..934a56ee21 100644 --- a/library/cpp/yson/parser.cpp +++ b/library/cpp/yson/parser.cpp @@ -16,22 +16,27 @@ namespace NYson { IInputStream* stream, EYsonType type, bool enableLinePositionInfo, + ui64 bufferSizeLimit, + bool consumeUntilEof, TMaybe<ui64> memoryLimit = Nothing()) : Consumer_(consumer) , Stream_(stream) , Type_(type) , EnableLinePositionInfo_(enableLinePositionInfo) + , BufferSizeLimit_(bufferSizeLimit) + , ConsumeUntilEof_(consumeUntilEof) , MemoryLimit_(memoryLimit) { } void Parse() { - TBuffer buffer(64 << 10); + TBuffer buffer(BufferSizeLimit_); ParseYsonStreamImpl<NYT::NYson::IYsonConsumer, TStreamReader>( TStreamReader(Stream_, buffer.Data(), buffer.Capacity()), Consumer_, Type_, EnableLinePositionInfo_, + ConsumeUntilEof_, MemoryLimit_); } @@ -40,6 +45,8 @@ namespace NYson { IInputStream* Stream_; EYsonType Type_; bool EnableLinePositionInfo_; + ui64 BufferSizeLimit_; + bool ConsumeUntilEof_; TMaybe<ui64> MemoryLimit_; }; @@ -50,8 +57,10 @@ namespace NYson { IInputStream* stream, EYsonType type, bool enableLinePositionInfo, + ui64 bufferSizeLimit, + bool consumeUntilEof, TMaybe<ui64> memoryLimit) - : Impl(new TImpl(consumer, stream, type, enableLinePositionInfo, memoryLimit)) + : Impl(new TImpl(consumer, stream, type, enableLinePositionInfo, bufferSizeLimit, consumeUntilEof, memoryLimit)) { } @@ -115,6 +124,7 @@ namespace NYson { consumer, type, enableLinePositionInfo, + true, memoryLimit); } |