aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/yson_string/string.cpp
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2022-09-15 10:16:02 +0300
committerbabenko <babenko@yandex-team.com>2022-09-15 10:16:02 +0300
commitb9588379f518a95feabccf562b290a487f8f130a (patch)
treea0e9303aaaa0ec7fb9d983c884ccb4d5b9f4c327 /library/cpp/yt/yson_string/string.cpp
parent83f3ea3ed2808ba1449a8af8aa3f72f29bc80efa (diff)
downloadydb-b9588379f518a95feabccf562b290a487f8f130a.tar.gz
Support logging unstructured messages to structured log
Diffstat (limited to 'library/cpp/yt/yson_string/string.cpp')
-rw-r--r--library/cpp/yt/yson_string/string.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp
index 99d45e8616..15eafdf615 100644
--- a/library/cpp/yt/yson_string/string.cpp
+++ b/library/cpp/yt/yson_string/string.cpp
@@ -155,7 +155,7 @@ TString TYsonString::ToString() const
[] (const TNullPayload&) -> TString {
YT_ABORT();
},
- [&] (const TRefCountedPtr&) {
+ [&] (const THolder&) {
return TString(AsStringBuf());
},
[] (const TString& payload) {
@@ -163,6 +163,21 @@ TString TYsonString::ToString() const
});
}
+TSharedRef TYsonString::ToSharedRef() const
+{
+ return Visit(
+ Payload_,
+ [] (const TNullPayload&) -> TSharedRef {
+ YT_ABORT();
+ },
+ [&] (const THolder& holder) {
+ return TSharedRef(Begin_, Size_, holder);
+ },
+ [] (const TString& payload) {
+ return TSharedRef::FromString(payload);
+ });
+}
+
size_t TYsonString::ComputeHash() const
{
return THash<TStringBuf>()(TStringBuf(Begin_, Begin_ + Size_));