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/node/node_io.h | |
parent | 7930380b354abe9969174901a4e8a730ab1d0906 (diff) | |
download | ydb-c015541a60f8d93070c53511daaff81db730d194.tar.gz |
YT: Add NodeFromYsonStreamNonGreedy; use it in TNode::Load
В рамках
3547980204d51d6eba4c3b56989a916379526673
Diffstat (limited to 'library/cpp/yson/node/node_io.h')
-rw-r--r-- | library/cpp/yson/node/node_io.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/cpp/yson/node/node_io.h b/library/cpp/yson/node/node_io.h index 1348d88bbb..2db1318db4 100644 --- a/library/cpp/yson/node/node_io.h +++ b/library/cpp/yson/node/node_io.h @@ -23,6 +23,13 @@ TString NodeToCanonicalYsonString(const TNode& node, ::NYson::EYsonFormat format // Parse TNode from stream in YSON format TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); +// Parse TNode from stream in YSON format. +// NB: This is substantially slower (1.5-2x using the benchmark from `./benchmark/saveload.cpp`) than using +// the original `NodeFromYsonStream`. +// Stops reading from `input` as soon as some valid YSON was read, leaving the remainder of the stream unread. +// Used in TNode::Load to support cases of saveloading multiple values after the TNode from/to the same stream. +TNode NodeFromYsonStreamNonGreedy(IInputStream* input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); + // Serialize TNode to stream in one of YSON formats with random order of maps' keys (don't use in tests) void NodeToYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); |