summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbabenko <[email protected]>2026-05-18 18:23:26 +0300
committerbabenko <[email protected]>2026-05-18 18:44:09 +0300
commitb7add35b490546eabbcd8ee474117c90cd6819ac (patch)
treebc03314b91f85f2145dbd719169da527ab76b0fa
parentfdb5a72481f8924abbc5e3215b68d7fa9c04eedf (diff)
YT-22593: Migrate yt/yt/ytree to std::string
commit_hash:3466775b052bc8a85a2aa85e9605968e7a5ea025
-rw-r--r--library/cpp/yt/yson_string/string.cpp34
-rw-r--r--library/cpp/yt/yson_string/string.h20
-rw-r--r--library/cpp/yt/yson_string/unittests/saveload_ut.cpp2
-rw-r--r--yt/yt/core/misc/statistic_path.cpp8
-rw-r--r--yt/yt/core/misc/statistic_path.h4
-rw-r--r--yt/yt/core/yson/protobuf_interop.cpp2
-rw-r--r--yt/yt/core/ytree/attribute_consumer.cpp4
-rw-r--r--yt/yt/core/ytree/attribute_consumer.h4
-rw-r--r--yt/yt/core/ytree/attribute_filter.cpp4
-rw-r--r--yt/yt/core/ytree/convert-inl.h5
-rw-r--r--yt/yt/core/ytree/ephemeral_node_factory.cpp2
-rw-r--r--yt/yt/core/ytree/exception_helpers.cpp6
-rw-r--r--yt/yt/core/ytree/exception_helpers.h4
-rw-r--r--yt/yt/core/ytree/helpers.cpp6
-rw-r--r--yt/yt/core/ytree/interned_attributes.cpp14
-rw-r--r--yt/yt/core/ytree/interned_attributes.h4
-rw-r--r--yt/yt/core/ytree/node.h4
-rw-r--r--yt/yt/core/ytree/node_detail.cpp14
-rw-r--r--yt/yt/core/ytree/node_detail.h4
-rw-r--r--yt/yt/core/ytree/permission.cpp4
-rw-r--r--yt/yt/core/ytree/permission.h2
-rw-r--r--yt/yt/core/ytree/public.h2
-rw-r--r--yt/yt/core/ytree/request_complexity_limits.cpp2
-rw-r--r--yt/yt/core/ytree/serialize-inl.h14
-rw-r--r--yt/yt/core/ytree/serialize.cpp6
-rw-r--r--yt/yt/core/ytree/static_service_dispatcher.h2
-rw-r--r--yt/yt/core/ytree/tree_builder.cpp6
-rw-r--r--yt/yt/core/ytree/tree_visitor.cpp2
-rw-r--r--yt/yt/core/ytree/unittests/attributes_ut.cpp22
-rw-r--r--yt/yt/core/ytree/unittests/complex_key_map.cpp2
-rw-r--r--yt/yt/core/ytree/unittests/complex_key_map.h6
-rw-r--r--yt/yt/core/ytree/unittests/options_ut.cpp6
-rw-r--r--yt/yt/core/ytree/unittests/serialize_ut.cpp68
-rw-r--r--yt/yt/core/ytree/unittests/size_ut.cpp4
-rw-r--r--yt/yt/core/ytree/unittests/tree_builder_ut.cpp2
-rw-r--r--yt/yt/core/ytree/unittests/yson_schema_ut.cpp54
-rw-r--r--yt/yt/core/ytree/unittests/yson_struct_update_ut.cpp20
-rw-r--r--yt/yt/core/ytree/unittests/yson_struct_ut.cpp90
-rw-r--r--yt/yt/core/ytree/unittests/ytree_fluent_ut.cpp2
-rw-r--r--yt/yt/core/ytree/unittests/ytree_ut.cpp16
-rw-r--r--yt/yt/core/ytree/virtual-inl.h21
-rw-r--r--yt/yt/core/ytree/virtual.cpp6
-rw-r--r--yt/yt/core/ytree/virtual.h2
-rw-r--r--yt/yt/core/ytree/ypath_client.cpp16
-rw-r--r--yt/yt/core/ytree/ypath_client.h4
-rw-r--r--yt/yt/core/ytree/ypath_detail.cpp16
-rw-r--r--yt/yt/core/ytree/ypath_detail.h16
-rw-r--r--yt/yt/core/ytree/ypath_resolver.cpp34
-rw-r--r--yt/yt/core/ytree/ypath_resolver.h6
-rw-r--r--yt/yt/core/ytree/ypath_service.cpp2
-rw-r--r--yt/yt/core/ytree/yson_schema-inl.h2
-rw-r--r--yt/yt/core/ytree/yson_struct_update-inl.h2
-rw-r--r--yt/yt/core/ytree/yson_struct_update.h2
-rw-r--r--yt/yt/library/skiff_ext/schema_match.cpp6
54 files changed, 328 insertions, 284 deletions
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp
index c21783b204a..2680cdbcdcf 100644
--- a/library/cpp/yt/yson_string/string.cpp
+++ b/library/cpp/yt/yson_string/string.cpp
@@ -61,13 +61,6 @@ EYsonType TYsonStringBuf::GetType() const
////////////////////////////////////////////////////////////////////////////////
-TYsonString::TYsonString()
-{
- Begin_ = nullptr;
- Size_ = 0;
- Type_ = EYsonType::Node; // fake
-}
-
TYsonString::TYsonString(const TYsonStringBuf& ysonStringBuf)
{
if (ysonStringBuf) {
@@ -94,21 +87,32 @@ TYsonString::TYsonString(
TYsonString::TYsonString(
const TString& data,
EYsonType type)
- : Payload_(TCowString(data))
+ : TYsonString(TCowString(data), type)
+{ }
+
+TYsonString::TYsonString(
+ TCowString data,
+ EYsonType type)
+ : Payload_(std::move(data))
, Begin_(std::get<TCowString>(Payload_).data())
- , Size_(data.length())
+ , Size_(std::get<TCowString>(Payload_).length())
, Type_(type)
{ }
TYsonString::TYsonString(
+ std::string data,
+ EYsonType type)
+ : TYsonString(TCowString(std::move(data)), type)
+{ }
+
+TYsonString::TYsonString(
const TSharedRef& data,
EYsonType type)
-{
- Payload_ = data.GetHolder();
- Begin_ = data.Begin();
- Size_ = data.Size();
- Type_ = type;
-}
+ : Payload_(data.GetHolder())
+ , Begin_(data.Begin())
+ , Size_(data.Size())
+ , Type_(type)
+{ }
TYsonString::operator bool() const
{
diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h
index 45cec2fb8c1..c93240ebade 100644
--- a/library/cpp/yt/yson_string/string.h
+++ b/library/cpp/yt/yson_string/string.h
@@ -67,7 +67,7 @@ class TYsonString
{
public:
//! Constructs a null instance.
- TYsonString();
+ TYsonString() = default;
//! Constructs an instance from TYsonStringBuf.
//! Copies the data into a ref-counted payload.
@@ -85,6 +85,18 @@ public:
const TString& data,
EYsonType type = EYsonType::Node);
+ //! Constructs an instance from TCowString.
+ //! Zero-copy: retains the reference to TCowString in payload.
+ explicit TYsonString(
+ TCowString data,
+ EYsonType type = EYsonType::Node);
+
+ //! Constructs an instance from std::string.
+ //! Moves #data into a ref-counted payload.
+ explicit TYsonString(
+ std::string data,
+ EYsonType type = EYsonType::Node);
+
//! Constructs an instance from TSharedRef.
//! Zero-copy; retains the reference to TSharedRef holder in payload.
explicit TYsonString(
@@ -121,9 +133,9 @@ private:
std::variant<TNullPayload, TSharedRangeHolderPtr, TCowString> Payload_;
- const char* Begin_;
- ui64 Size_ : 56;
- EYsonType Type_ : 8;
+ const char* Begin_ = nullptr;
+ ui64 Size_ : 56 = 0;
+ EYsonType Type_ : 8 = EYsonType::Node;
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/yson_string/unittests/saveload_ut.cpp b/library/cpp/yt/yson_string/unittests/saveload_ut.cpp
index 33a98a30ea4..a7700fb2ff6 100644
--- a/library/cpp/yt/yson_string/unittests/saveload_ut.cpp
+++ b/library/cpp/yt/yson_string/unittests/saveload_ut.cpp
@@ -31,7 +31,7 @@ TEST(TYsonStringTest, SaveLoadString)
TEST(TYsonStringTest, SaveLoadSharedRef)
{
- TSharedRef ref = TSharedRef::FromString("My tests data");
+ auto ref = TSharedRef::FromString("My tests data");
const TYsonString expected(ref);
TStringStream s;
::Save(&s, expected);
diff --git a/yt/yt/core/misc/statistic_path.cpp b/yt/yt/core/misc/statistic_path.cpp
index 58fdcbb5ea7..5526697d320 100644
--- a/yt/yt/core/misc/statistic_path.cpp
+++ b/yt/yt/core/misc/statistic_path.cpp
@@ -58,7 +58,7 @@ TStatisticPath::TStatisticPath(TStatisticPathType&& path) noexcept
{ }
TStatisticPath::TStatisticPath(const TStatisticPathLiteral& literal)
- : Path_(TStatisticPathType(Delimiter) + literal.Literal())
+ : Path_(TStatisticPathType(1, Delimiter) + literal.Literal())
{ }
////////////////////////////////////////////////////////////////////////////////
@@ -68,18 +68,18 @@ TError CheckStatisticPath(const TStatisticPathType& path)
constexpr static TChar twoDelimiters[2]{Delimiter, Delimiter};
constexpr static TBasicStringBuf<TChar> adjacentDelimiters(twoDelimiters, 2);
- TError error;
if (path.empty()) {
return {};
}
+ TError error;
if (path.front() != Delimiter) {
error = TError("Statistic path must start with a delimiter");
} else if (path.back() == Delimiter) {
error = TError("Statistic path must not end with a delimiter");
- } else if (path.Contains(0)) {
+ } else if (path.find(NStatisticPath::TChar(0)) != TStatisticPathType::npos) {
error = TError("Statistic path must not contain a null character");
- } else if (path.Contains(adjacentDelimiters)) {
+ } else if (path.find(adjacentDelimiters.data(), 0, adjacentDelimiters.size()) != TStatisticPathType::npos) {
error = TError("Statistic path must not contain adjacent delimiters");
}
diff --git a/yt/yt/core/misc/statistic_path.h b/yt/yt/core/misc/statistic_path.h
index 4e5d3833f85..e8187a0607a 100644
--- a/yt/yt/core/misc/statistic_path.h
+++ b/yt/yt/core/misc/statistic_path.h
@@ -15,9 +15,9 @@ namespace NStatisticPath {
////////////////////////////////////////////////////////////////////////////////
//! A type to store paths and literals as.
-using TStatisticPathType = TString;
+using TStatisticPathType = std::string;
-using TChar = TStatisticPathType::TChar;
+using TChar = TStatisticPathType::value_type;
//! Delimiter character to use instead of `/`. We want it to compare "less" than any other character.
//! See YT-22118 for motivation.
diff --git a/yt/yt/core/yson/protobuf_interop.cpp b/yt/yt/core/yson/protobuf_interop.cpp
index bc55fa178ec..a08cbf223e8 100644
--- a/yt/yt/core/yson/protobuf_interop.cpp
+++ b/yt/yt/core/yson/protobuf_interop.cpp
@@ -1171,7 +1171,7 @@ int ConvertToProtobufEnumValueUntyped(
return value;
}
case NYTree::ENodeType::String: {
- const TString& literal = node->AsString()->GetValue();
+ const auto& literal = node->AsString()->GetValue();
auto value = type->FindValueByLiteral(literal);
THROW_ERROR_EXCEPTION_UNLESS(value,
"Unknown value %Qv of enum %Qv",
diff --git a/yt/yt/core/ytree/attribute_consumer.cpp b/yt/yt/core/ytree/attribute_consumer.cpp
index 5fbe929182d..8b4c9a37a45 100644
--- a/yt/yt/core/ytree/attribute_consumer.cpp
+++ b/yt/yt/core/ytree/attribute_consumer.cpp
@@ -9,7 +9,7 @@ using namespace NYson;
////////////////////////////////////////////////////////////////////////////////
-TAttributeConsumer::TAttributeConsumer(IAttributeDictionary* attributes, std::optional<THashSet<TString>> keyWhitelist)
+TAttributeConsumer::TAttributeConsumer(IAttributeDictionary* attributes, std::optional<THashSet<std::string>> keyWhitelist)
: Attributes_(attributes)
, KeyWhitelist_(std::move(keyWhitelist))
{ }
@@ -22,7 +22,7 @@ IAttributeDictionary* TAttributeConsumer::GetAttributes() const
void TAttributeConsumer::OnMyKeyedItem(TStringBuf key)
{
Writer_.reset(new TBufferedBinaryYsonWriter(&Output_));
- Forward(Writer_.get(), [this, key = TString(key)] {
+ Forward(Writer_.get(), [this, key = std::string(key)] {
Writer_->Flush();
Writer_.reset();
if (!KeyWhitelist_ || KeyWhitelist_->contains(key)) {
diff --git a/yt/yt/core/ytree/attribute_consumer.h b/yt/yt/core/ytree/attribute_consumer.h
index 4c1fd206df6..fa0fb29c41e 100644
--- a/yt/yt/core/ytree/attribute_consumer.h
+++ b/yt/yt/core/ytree/attribute_consumer.h
@@ -14,7 +14,7 @@ class TAttributeConsumer
: public NYson::TForwardingYsonConsumer
{
public:
- explicit TAttributeConsumer(IAttributeDictionary* attributes, std::optional<THashSet<TString>> keyWhitelist = {});
+ explicit TAttributeConsumer(IAttributeDictionary* attributes, std::optional<THashSet<std::string>> keyWhitelist = {});
IAttributeDictionary* GetAttributes() const;
protected:
@@ -35,7 +35,7 @@ protected:
private:
IAttributeDictionary* const Attributes_;
- const std::optional<THashSet<TString>> KeyWhitelist_;
+ const std::optional<THashSet<std::string>> KeyWhitelist_;
TStringStream Output_;
std::unique_ptr<NYson::TBufferedBinaryYsonWriter> Writer_;
diff --git a/yt/yt/core/ytree/attribute_filter.cpp b/yt/yt/core/ytree/attribute_filter.cpp
index 1d760780b64..7938973f534 100644
--- a/yt/yt/core/ytree/attribute_filter.cpp
+++ b/yt/yt/core/ytree/attribute_filter.cpp
@@ -283,7 +283,7 @@ TAttributeFilter::TKeyToFilter TAttributeFilter::Normalize() const
// Finally, group remaining paths by the first token in path.
//! Split a path into a first key value and a remaining suffix.
- auto splitPath = [] (const TYPath& path) -> std::pair<TString, TYPath> {
+ auto splitPath = [] (const TYPath& path) -> std::pair<std::string, TYPath> {
NYPath::TTokenizer tokenizer(path);
tokenizer.Expect(NYPath::ETokenType::StartOfStream);
tokenizer.Advance();
@@ -297,7 +297,7 @@ TAttributeFilter::TKeyToFilter TAttributeFilter::Normalize() const
TKeyToFilter result;
- TString firstKey;
+ std::string firstKey;
TYPath firstSuffix;
std::tie(firstKey, firstSuffix) = splitPath(paths.front());
std::vector<TYPath> subpaths = {std::move(firstSuffix)};
diff --git a/yt/yt/core/ytree/convert-inl.h b/yt/yt/core/ytree/convert-inl.h
index 46a80da100d..cc608cc0eea 100644
--- a/yt/yt/core/ytree/convert-inl.h
+++ b/yt/yt/core/ytree/convert-inl.h
@@ -180,6 +180,7 @@ T ConstructYTreeConvertibleObject()
////////////////////////////////////////////////////////////////////////////////
+
template <class TTo>
TTo ConvertTo(const NYTree::INodePtr& node)
{
@@ -275,13 +276,13 @@ inline double ConvertTo(const NYson::TYsonStringBuf& str)
}
template <>
-inline TString ConvertTo(const NYson::TYsonString& str)
+inline std::string ConvertTo(const NYson::TYsonString& str)
{
return NDetail::ConvertYsonStringBufToString(str);
}
template <>
-inline TString ConvertTo(const NYson::TYsonStringBuf& str)
+inline std::string ConvertTo(const NYson::TYsonStringBuf& str)
{
return NDetail::ConvertYsonStringBufToString(str);
}
diff --git a/yt/yt/core/ytree/ephemeral_node_factory.cpp b/yt/yt/core/ytree/ephemeral_node_factory.cpp
index 2d94e4399e0..6ba5a439ca8 100644
--- a/yt/yt/core/ytree/ephemeral_node_factory.cpp
+++ b/yt/yt/core/ytree/ephemeral_node_factory.cpp
@@ -141,7 +141,7 @@ private:
using TScalarNode::TScalarNode; \
};
-DECLARE_SCALAR_TYPE(String, TString)
+DECLARE_SCALAR_TYPE(String, std::string)
DECLARE_SCALAR_TYPE(Int64, i64)
DECLARE_SCALAR_TYPE(Uint64, ui64)
DECLARE_SCALAR_TYPE(Double, double)
diff --git a/yt/yt/core/ytree/exception_helpers.cpp b/yt/yt/core/ytree/exception_helpers.cpp
index 5a4043fa38b..348b2bd9711 100644
--- a/yt/yt/core/ytree/exception_helpers.cpp
+++ b/yt/yt/core/ytree/exception_helpers.cpp
@@ -18,7 +18,7 @@ using namespace NYPath;
namespace {
-TString GetNodePath(const IConstNodePtr& node)
+std::string GetNodePath(const IConstNodePtr& node)
{
auto path = node->GetPath();
return path.empty() ? "Root node" : Format("Node %v", path);
@@ -39,7 +39,7 @@ void ThrowInvalidNodeType(const IConstNodePtr& node, ENodeType expectedType, ENo
void ValidateNodeType(
const IConstNodePtr& node,
const THashSet<ENodeType>& expectedTypes,
- const TString& expectedTypesStringRepresentation)
+ const std::string& expectedTypesStringRepresentation)
{
if (!expectedTypes.contains(node->GetType())) {
THROW_ERROR_EXCEPTION(
@@ -99,7 +99,7 @@ void ThrowNoSuchBuiltinAttribute(TStringBuf key)
ToYPathLiteral(key));
}
-void ThrowMethodNotSupported(TStringBuf method, const std::optional<TString>& resolveType)
+void ThrowMethodNotSupported(TStringBuf method, const std::optional<std::string>& resolveType)
{
auto error = TError(
NRpc::EErrorCode::NoSuchMethod,
diff --git a/yt/yt/core/ytree/exception_helpers.h b/yt/yt/core/ytree/exception_helpers.h
index 49f68abef5e..79bf95b59f5 100644
--- a/yt/yt/core/ytree/exception_helpers.h
+++ b/yt/yt/core/ytree/exception_helpers.h
@@ -17,7 +17,7 @@ namespace NYT::NYTree {
void ValidateNodeType(
const IConstNodePtr& node,
const THashSet<ENodeType>& expectedTypes,
- const TString& expectedTypesStringRepresentation);
+ const std::string& expectedTypesStringRepresentation);
[[noreturn]] void ThrowNoSuchChildKey(const IConstNodePtr& node, TStringBuf key);
[[noreturn]] void ThrowNoSuchChildKey(TStringBuf key);
@@ -27,7 +27,7 @@ void ValidateNodeType(
[[noreturn]] void ThrowNoSuchCustomAttribute(TStringBuf key);
[[noreturn]] void ThrowMethodNotSupported(
TStringBuf method,
- const std::optional<TString>& resolveType = {});
+ const std::optional<std::string>& resolveType = {});
[[noreturn]] void ThrowMethodNotSupportedForAttributes(TStringBuf method);
[[noreturn]] void ThrowCannotHaveChildren(const IConstNodePtr& node);
[[noreturn]] void ThrowAlreadyExists(const IConstNodePtr& node);
diff --git a/yt/yt/core/ytree/helpers.cpp b/yt/yt/core/ytree/helpers.cpp
index e994a38feb3..e65e2464ab7 100644
--- a/yt/yt/core/ytree/helpers.cpp
+++ b/yt/yt/core/ytree/helpers.cpp
@@ -243,8 +243,8 @@ IAttributeDictionaryPtr FromProto(const NProto::TAttributeDictionary& protoAttri
{
auto attributes = CreateEphemeralAttributes();
for (const auto& protoAttribute : protoAttributes.attributes()) {
- auto key = FromProto<TString>(protoAttribute.key());
- auto value = FromProto<TString>(protoAttribute.value());
+ auto key = FromProto<std::string>(protoAttribute.key());
+ auto value = FromProto<std::string>(protoAttribute.value());
attributes->SetYson(key, TYsonString(value));
}
return attributes;
@@ -302,7 +302,7 @@ void TAttributeDictionarySerializer::LoadNonNull(TStreamLoadContext& context, co
attributes->Clear();
size_t size = TSizeSerializer::Load(context);
for (size_t index = 0; index < size; ++index) {
- auto key = Load<TString>(context);
+ auto key = Load<std::string>(context);
auto value = Load<TYsonString>(context);
attributes->SetYson(key, value);
}
diff --git a/yt/yt/core/ytree/interned_attributes.cpp b/yt/yt/core/ytree/interned_attributes.cpp
index 1ab94f5c190..95cbd6bd47d 100644
--- a/yt/yt/core/ytree/interned_attributes.cpp
+++ b/yt/yt/core/ytree/interned_attributes.cpp
@@ -12,7 +12,7 @@ namespace {
class TInternedAttributeRegistry
{
public:
- void Intern(const TString& uninternedKey, TInternedAttributeKey internedKey)
+ void Intern(const std::string& uninternedKey, TInternedAttributeKey internedKey)
{
YT_VERIFY(AttributeNameToIndex_.emplace(uninternedKey, internedKey).second);
YT_VERIFY(AttributeIndexToName_.emplace(internedKey, uninternedKey).second);
@@ -24,19 +24,19 @@ public:
return it == AttributeNameToIndex_.end() ? InvalidInternedAttribute : it->second;
}
- const TString& GetUninterned(TInternedAttributeKey internedKey)
+ const std::string& GetUninterned(TInternedAttributeKey internedKey)
{
return GetOrCrash(AttributeIndexToName_, internedKey);
}
private:
- THashMap<TString, TInternedAttributeKey> AttributeNameToIndex_;
- THashMap<TInternedAttributeKey, TString> AttributeIndexToName_;
+ THashMap<std::string, TInternedAttributeKey> AttributeNameToIndex_;
+ THashMap<TInternedAttributeKey, std::string> AttributeIndexToName_;
};
} // namespace
-void InternAttribute(const TString& uninternedKey, TInternedAttributeKey internedKey)
+void InternAttribute(const std::string& uninternedKey, TInternedAttributeKey internedKey)
{
Singleton<TInternedAttributeRegistry>()->Intern(uninternedKey, internedKey);
}
@@ -58,7 +58,7 @@ void TInternedAttributeKey::Load(TStreamLoadContext& context)
{
using NYT::Load;
- auto uninternedKey = Load<TString>(context);
+ auto uninternedKey = Load<std::string>(context);
Code_ = Lookup(uninternedKey).Code_;
}
@@ -67,7 +67,7 @@ void TInternedAttributeKey::Load(TStreamLoadContext& context)
return Singleton<TInternedAttributeRegistry>()->GetInterned(uninternedKey);
}
-const TString& TInternedAttributeKey::Unintern() const
+const std::string& TInternedAttributeKey::Unintern() const
{
return Singleton<TInternedAttributeRegistry>()->GetUninterned(*this);
}
diff --git a/yt/yt/core/ytree/interned_attributes.h b/yt/yt/core/ytree/interned_attributes.h
index 2e2c675b6ed..7ef3ae9d868 100644
--- a/yt/yt/core/ytree/interned_attributes.h
+++ b/yt/yt/core/ytree/interned_attributes.h
@@ -22,7 +22,7 @@ public:
// May return #InvalidInternedAttribute if the attribute is not interned.
static TInternedAttributeKey Lookup(TStringBuf uninternedKey);
- const TString& Unintern() const;
+ const std::string& Unintern() const;
void Save(TStreamSaveContext& context) const;
void Load(TStreamLoadContext& context);
@@ -38,7 +38,7 @@ constexpr TInternedAttributeKey CountInternedAttribute{1};
//! Interned attribute registry initialization. Should be called once per attribute.
//! Both interned and uninterned keys must be unique.
-void InternAttribute(const TString& uninternedKey, TInternedAttributeKey internedKey);
+void InternAttribute(const std::string& uninternedKey, TInternedAttributeKey internedKey);
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/ytree/node.h b/yt/yt/core/ytree/node.h
index 946e93f8a9a..581b185a271 100644
--- a/yt/yt/core/ytree/node.h
+++ b/yt/yt/core/ytree/node.h
@@ -95,13 +95,13 @@ struct IScalarNode
XX(Uint64, ui64) \
XX(Double, double) \
XX(Boolean, bool) \
- XX(String, TString)
+ XX(String, std::string)
////////////////////////////////////////////////////////////////////////////////
//! String node.
struct IStringNode
- : public IScalarNode<TString>
+ : public IScalarNode<std::string>
{ };
DEFINE_REFCOUNTED_TYPE(IStringNode)
diff --git a/yt/yt/core/ytree/node_detail.cpp b/yt/yt/core/ytree/node_detail.cpp
index faec99f2141..02b3935d118 100644
--- a/yt/yt/core/ytree/node_detail.cpp
+++ b/yt/yt/core/ytree/node_detail.cpp
@@ -91,7 +91,7 @@ void TNodeBase::GetKeySelf(
THROW_ERROR_EXCEPTION("Node has no parent");
}
- TString key;
+ std::string key;
switch (parent->GetType()) {
case ENodeType::Map:
key = parent->AsMap()->GetChildKeyOrThrow(this);
@@ -165,14 +165,14 @@ IYPathService::TResolveResult TNodeBase::ResolveRecursive(
TYPath TNodeBase::GetPath() const
{
- TCompactVector<TString, 64> tokens;
+ TCompactVector<std::string, 64> tokens;
IConstNodePtr current(this);
while (true) {
auto parent = current->GetParent();
if (!parent) {
break;
}
- TString token;
+ std::string token;
switch (parent->GetType()) {
case ENodeType::List: {
auto index = parent->AsList()->GetChildIndexOrThrow(current);
@@ -362,7 +362,7 @@ void TMapNodeMixin::ListSelf(
}));
}
-std::pair<TString, INodePtr> TMapNodeMixin::PrepareSetChildOrChildValue(
+std::pair<std::string, INodePtr> TMapNodeMixin::PrepareSetChildOrChildValue(
INodeFactory* factory,
const TYPath& path,
std::variant<INodePtr, NYson::TYsonString> childOrChildValue,
@@ -381,7 +381,7 @@ std::pair<TString, INodePtr> TMapNodeMixin::PrepareSetChildOrChildValue(
IMapNodePtr rootNode = AsMap();
INodePtr rootChild;
- TString rootKey;
+ std::optional<std::string> rootKey;
auto currentNode = rootNode;
try {
@@ -434,10 +434,10 @@ std::pair<TString, INodePtr> TMapNodeMixin::PrepareSetChildOrChildValue(
}
YT_VERIFY(rootKey);
- return {rootKey, rootChild};
+ return {std::move(*rootKey), std::move(rootChild)};
}
-std::pair<TString, INodePtr> TMapNodeMixin::PrepareSetChild(
+std::pair<std::string, INodePtr> TMapNodeMixin::PrepareSetChild(
INodeFactory* factory,
const TYPath& path,
INodePtr child,
diff --git a/yt/yt/core/ytree/node_detail.h b/yt/yt/core/ytree/node_detail.h
index 2a70bf21060..60282c8fe9d 100644
--- a/yt/yt/core/ytree/node_detail.h
+++ b/yt/yt/core/ytree/node_detail.h
@@ -124,7 +124,7 @@ protected:
INodePtr child,
bool recursive) override;
- std::pair<TString, INodePtr> PrepareSetChild(
+ std::pair<std::string, INodePtr> PrepareSetChild(
INodeFactory* factory,
const TYPath& path,
INodePtr child,
@@ -139,7 +139,7 @@ protected:
bool recursive) final;
private:
- std::pair<TString, INodePtr> PrepareSetChildOrChildValue(
+ std::pair<std::string, INodePtr> PrepareSetChildOrChildValue(
INodeFactory* factory,
const TYPath& path,
std::variant<INodePtr, NYson::TYsonString> childOrChildValue,
diff --git a/yt/yt/core/ytree/permission.cpp b/yt/yt/core/ytree/permission.cpp
index a3d9f755f13..aab42166ae5 100644
--- a/yt/yt/core/ytree/permission.cpp
+++ b/yt/yt/core/ytree/permission.cpp
@@ -6,9 +6,9 @@ namespace NYT::NYTree {
////////////////////////////////////////////////////////////////////////////////
-std::vector<TString> FormatPermissions(EPermissionSet permissions)
+std::vector<std::string> FormatPermissions(EPermissionSet permissions)
{
- std::vector<TString> result;
+ std::vector<std::string> result;
for (auto value : TEnumTraits<EPermission>::GetDomainValues()) {
if (Any(permissions & value)) {
result.push_back(FormatEnum(value));
diff --git a/yt/yt/core/ytree/permission.h b/yt/yt/core/ytree/permission.h
index 6cc0478b3ee..4c27bf60ec1 100644
--- a/yt/yt/core/ytree/permission.h
+++ b/yt/yt/core/ytree/permission.h
@@ -56,7 +56,7 @@ using EPermissionSet = EPermission;
const EPermissionSet NonePermissions = EPermissionSet(0x0000);
-std::vector<TString> FormatPermissions(EPermissionSet permissions);
+std::vector<std::string> FormatPermissions(EPermissionSet permissions);
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/ytree/public.h b/yt/yt/core/ytree/public.h
index 5625675a90e..e05c50ed354 100644
--- a/yt/yt/core/ytree/public.h
+++ b/yt/yt/core/ytree/public.h
@@ -142,7 +142,7 @@ using TTypedYPathServiceContext = NRpc::TGenericTypedServiceContext<
//! A static node type.
DEFINE_ENUM(ENodeType,
- // Node contains a string (TString).
+ // Node contains a string (std::string).
(String)
// Node contains an int64 number (i64).
(Int64)
diff --git a/yt/yt/core/ytree/request_complexity_limits.cpp b/yt/yt/core/ytree/request_complexity_limits.cpp
index c31d441efea..243414683f6 100644
--- a/yt/yt/core/ytree/request_complexity_limits.cpp
+++ b/yt/yt/core/ytree/request_complexity_limits.cpp
@@ -27,7 +27,7 @@ void TReadRequestComplexityOverrides::Validate(TReadRequestComplexity max) const
if (override && *override > max) {
error.SetCode(NYT::EErrorCode::Generic);
error.SetMessage("Read request complexity limits too large");
- error = error << TErrorAttribute(TString(fieldName), *override);
+ error = error << TErrorAttribute(std::string(fieldName), *override);
}
};
diff --git a/yt/yt/core/ytree/serialize-inl.h b/yt/yt/core/ytree/serialize-inl.h
index 0334335dda6..d73c02fe37e 100644
--- a/yt/yt/core/ytree/serialize-inl.h
+++ b/yt/yt/core/ytree/serialize-inl.h
@@ -25,7 +25,7 @@ namespace NYT::NYTree {
template <class T>
struct TAssociativeContainerKeyHelper
{
- static TString Serialize(const T& value)
+ static std::string Serialize(const T& value)
{
return ToString(value);
}
@@ -40,7 +40,7 @@ template <class T>
requires(TEnumTraits<T>::IsEnum)
struct TAssociativeContainerKeyHelper<T>
{
- static TString Serialize(const T& value)
+ static std::string Serialize(const T& value)
{
return FormatEnum(value);
}
@@ -54,7 +54,7 @@ struct TAssociativeContainerKeyHelper<T>
template <>
struct TAssociativeContainerKeyHelper<TGuid>
{
- static TString Serialize(TGuid value)
+ static std::string Serialize(TGuid value)
{
return ToString(value);
}
@@ -70,7 +70,7 @@ struct TAssociativeContainerKeyHelper<TStrongTypedef<T, TTag, Options>>
{
using TValue = TStrongTypedef<T, TTag, Options>;
- static TString Serialize(const TValue& value)
+ static std::string Serialize(const TValue& value)
{
return TAssociativeContainerKeyHelper<T>::Serialize(value.Underlying());
}
@@ -560,7 +560,7 @@ void Deserialize(T& value, INodePtr node)
case ENodeType::List:
value = T();
for (const auto& item : node->AsList()->GetChildren()) {
- value |= ParseEnum<T>(item->GetValue<TString>());
+ value |= ParseEnum<T>(item->GetValue<std::string>());
}
break;
case ENodeType::String:
@@ -573,7 +573,7 @@ void Deserialize(T& value, INodePtr node)
} else {
switch (node->GetType()) {
case ENodeType::String: {
- value = ParseEnum<T>(node->GetValue<TString>());
+ value = ParseEnum<T>(node->GetValue<std::string>());
break;
}
case ENodeType::Int64: {
@@ -744,7 +744,7 @@ void Deserialize(
T& message,
const INodePtr& node)
{
- TString string;
+ std::string string;
Deserialize(string, node);
message.ParseFromStringOrThrow(string);
}
diff --git a/yt/yt/core/ytree/serialize.cpp b/yt/yt/core/ytree/serialize.cpp
index 1fb22d57f69..03134297a55 100644
--- a/yt/yt/core/ytree/serialize.cpp
+++ b/yt/yt/core/ytree/serialize.cpp
@@ -279,7 +279,7 @@ void Deserialize(bool& value, INodePtr node)
// char
void Deserialize(char& value, INodePtr node)
{
- TString stringValue = node->AsString()->GetValue();
+ std::string stringValue = node->AsString()->GetValue();
if (stringValue.size() != 1) {
THROW_ERROR_EXCEPTION("Char cannot be parsed from string whose length is not equal to 1")
<< TErrorAttribute("string_length", stringValue.size());
@@ -377,10 +377,10 @@ void Deserialize(TGuid& value, INodePtr node)
// TStatisticPath.
void Deserialize(NStatisticPath::TStatisticPath& value, INodePtr node)
{
- const TString& path = node->AsString()->GetValue();
+ const std::string& path = node->AsString()->GetValue();
// Try to parse slashed paths.
- if (!path.empty() && path.StartsWith('/')) {
+ if (!path.empty() && path.starts_with('/')) {
value = NStatisticPath::SlashedStatisticPath(path).ValueOrThrow();
} else {
value = NStatisticPath::ParseStatisticPath(path).ValueOrThrow();
diff --git a/yt/yt/core/ytree/static_service_dispatcher.h b/yt/yt/core/ytree/static_service_dispatcher.h
index e05ddf68f0c..1e84743d99a 100644
--- a/yt/yt/core/ytree/static_service_dispatcher.h
+++ b/yt/yt/core/ytree/static_service_dispatcher.h
@@ -29,7 +29,7 @@ protected:
void RegisterService(TStringBuf key, TCallback<IYPathServicePtr()> serviceFactory);
private:
- THashMap<TString, TCallback<IYPathServicePtr()>> Services_;
+ THashMap<std::string, TCallback<IYPathServicePtr()>> Services_;
void ListSelf(
TReqList* /*request*/,
diff --git a/yt/yt/core/ytree/tree_builder.cpp b/yt/yt/core/ytree/tree_builder.cpp
index b1cce05653a..ea6ed14ce0e 100644
--- a/yt/yt/core/ytree/tree_builder.cpp
+++ b/yt/yt/core/ytree/tree_builder.cpp
@@ -52,7 +52,7 @@ public:
void OnMyStringScalar(TStringBuf value) override
{
auto node = Factory_->CreateString();
- node->SetValue(TString(value));
+ node->SetValue(std::string(value));
AddNode(node, false);
}
@@ -111,7 +111,7 @@ public:
void OnMyKeyedItem(TStringBuf key) override
{
- Key_ = TString(key);
+ Key_ = std::string(key);
}
void OnMyEndMap() override
@@ -138,7 +138,7 @@ private:
//! Contains nodes forming the current path in the tree.
std::stack<INodePtr> NodeStack_;
- std::optional<TString> Key_;
+ std::optional<std::string> Key_;
INodePtr ResultNode_;
std::unique_ptr<TAttributeConsumer> AttributeConsumer_;
IAttributeDictionaryPtr Attributes_;
diff --git a/yt/yt/core/ytree/tree_visitor.cpp b/yt/yt/core/ytree/tree_visitor.cpp
index d6e927bab48..a4d669700d9 100644
--- a/yt/yt/core/ytree/tree_visitor.cpp
+++ b/yt/yt/core/ytree/tree_visitor.cpp
@@ -48,7 +48,7 @@ private:
{
node->WriteAttributes(Consumer, AttributeFilter_, Stable_);
- static const TString opaqueAttributeName("opaque");
+ static const std::string opaqueAttributeName("opaque");
if (!isRoot &&
node->Attributes().Get<bool>(opaqueAttributeName, false))
{
diff --git a/yt/yt/core/ytree/unittests/attributes_ut.cpp b/yt/yt/core/ytree/unittests/attributes_ut.cpp
index f0f4c9ff9ec..573d92c5864 100644
--- a/yt/yt/core/ytree/unittests/attributes_ut.cpp
+++ b/yt/yt/core/ytree/unittests/attributes_ut.cpp
@@ -27,13 +27,13 @@ protected:
TEST(TAttributesTest, CheckAccessors)
{
auto attributes = CreateEphemeralAttributes();
- attributes->Set<TString>("name", "Petr");
+ attributes->Set<std::string>("name", "Petr");
attributes->Set<int>("age", 30);
attributes->Set<double>("weight", 70.5);
auto keys_ = attributes->ListKeys();
- THashSet<TString> keys(keys_.begin(), keys_.end());
- THashSet<TString> expectedKeys{
+ THashSet<std::string> keys(keys_.begin(), keys_.end());
+ THashSet<std::string> expectedKeys{
"name",
"age",
"weight",
@@ -49,7 +49,7 @@ TEST(TAttributesTest, CheckAccessors)
};
EXPECT_EQ(pairs, expectedPairs);
- EXPECT_EQ("Petr", attributes->Get<TString>("name"));
+ EXPECT_EQ("Petr", attributes->Get<std::string>("name"));
EXPECT_THROW(attributes->Get<int>("name"), std::exception);
EXPECT_EQ(30, attributes->Find<int>("age"));
@@ -57,7 +57,7 @@ TEST(TAttributesTest, CheckAccessors)
EXPECT_THROW(attributes->Get<char>("age"), std::exception);
EXPECT_EQ(70.5, attributes->Get<double>("weight"));
- EXPECT_THROW(attributes->Get<TString>("weight"), std::exception);
+ EXPECT_THROW(attributes->Get<std::string>("weight"), std::exception);
EXPECT_FALSE(attributes->Find<int>("unknown_key"));
EXPECT_EQ(42, attributes->Get<int>("unknown_key", 42));
@@ -67,26 +67,26 @@ TEST(TAttributesTest, CheckAccessors)
TEST(TAttributesTest, MergeFromTest)
{
auto attributesX = CreateEphemeralAttributes();
- attributesX->Set<TString>("name", "Petr");
+ attributesX->Set<std::string>("name", "Petr");
attributesX->Set<int>("age", 30);
auto attributesY = CreateEphemeralAttributes();
- attributesY->Set<TString>("name", "Oleg");
+ attributesY->Set<std::string>("name", "Oleg");
attributesX->MergeFrom(*attributesY);
- EXPECT_EQ("Oleg", attributesX->Get<TString>("name"));
+ EXPECT_EQ("Oleg", attributesX->Get<std::string>("name"));
EXPECT_EQ(30, attributesX->Get<int>("age"));
auto node = ConvertToNode(TYsonString(TStringBuf("{age=20}")));
attributesX->MergeFrom(node->AsMap());
- EXPECT_EQ("Oleg", attributesX->Get<TString>("name"));
+ EXPECT_EQ("Oleg", attributesX->Get<std::string>("name"));
EXPECT_EQ(20, attributesX->Get<int>("age"));
}
TEST(TAttributesTest, SerializeToNode)
{
auto attributes = CreateEphemeralAttributes();
- attributes->Set<TString>("name", "Petr");
+ attributes->Set<std::string>("name", "Petr");
attributes->Set<int>("age", 30);
auto node = ConvertToNode(*attributes);
@@ -97,7 +97,7 @@ TEST(TAttributesTest, SerializeToNode)
TEST(TAttributesTest, TrySerializeProtoToRef)
{
auto attributes = CreateEphemeralAttributes();
- attributes->Set<TString>("name", "Petr");
+ attributes->Set<std::string>("name", "Petr");
attributes->Set<int>("age", 30);
NProto::TAttributeDictionary protoAttributes;
diff --git a/yt/yt/core/ytree/unittests/complex_key_map.cpp b/yt/yt/core/ytree/unittests/complex_key_map.cpp
index c74641301c5..3b51ab17c55 100644
--- a/yt/yt/core/ytree/unittests/complex_key_map.cpp
+++ b/yt/yt/core/ytree/unittests/complex_key_map.cpp
@@ -18,7 +18,7 @@ TTestComplexKey TTestComplexKey::FromString(TStringBuf string)
return key;
}
-TString TTestComplexKey::ToString() const
+std::string TTestComplexKey::ToString() const
{
return Format("%v/%v", First, Second);
}
diff --git a/yt/yt/core/ytree/unittests/complex_key_map.h b/yt/yt/core/ytree/unittests/complex_key_map.h
index 1d65e2eadff..c50d53631e4 100644
--- a/yt/yt/core/ytree/unittests/complex_key_map.h
+++ b/yt/yt/core/ytree/unittests/complex_key_map.h
@@ -8,11 +8,11 @@ namespace NYT::NYTree {
struct TTestComplexKey
{
- TString First;
- TString Second;
+ std::string First;
+ std::string Second;
static TTestComplexKey FromString(TStringBuf string);
- TString ToString() const;
+ std::string ToString() const;
bool operator==(const TTestComplexKey& other) const;
bool operator<(const TTestComplexKey& other) const;
diff --git a/yt/yt/core/ytree/unittests/options_ut.cpp b/yt/yt/core/ytree/unittests/options_ut.cpp
index 8eef5f84202..f97b667d4c1 100644
--- a/yt/yt/core/ytree/unittests/options_ut.cpp
+++ b/yt/yt/core/ytree/unittests/options_ut.cpp
@@ -9,7 +9,7 @@ namespace {
struct TFirstOption
{
- TString Value;
+ std::string Value;
};
bool operator==(const TFirstOption& lhs, const TFirstOption& rhs)
@@ -30,10 +30,10 @@ bool operator==(const TSecondOption& lhs, const TSecondOption& rhs)
struct TTestStruct
: public TYsonStruct
{
- TString Nothing;
+ std::string Nothing;
i64 First;
double Second;
- TString Both;
+ std::string Both;
REGISTER_YSON_STRUCT(TTestStruct);
diff --git a/yt/yt/core/ytree/unittests/serialize_ut.cpp b/yt/yt/core/ytree/unittests/serialize_ut.cpp
index de3791f8245..91ed25b9668 100644
--- a/yt/yt/core/ytree/unittests/serialize_ut.cpp
+++ b/yt/yt/core/ytree/unittests/serialize_ut.cpp
@@ -112,12 +112,12 @@ void TestDeserialization(const TResult& expected, const TSource& source)
EXPECT_EQ(expected, ConvertTo<TResult>(node));
}
-TString RemoveSpaces(const TString& str)
+std::string RemoveSpaces(const std::string& str)
{
- TString res = str;
+ std::string res = str;
while (true) {
size_t pos = res.find(" ");
- if (pos == TString::npos) {
+ if (pos == std::string::npos) {
break;
}
res.replace(pos, 1, "");
@@ -143,7 +143,7 @@ TEST(TCustomTypeSerializationTest, TInstant)
TestDeserialization<TInstant, double>(value, 100500.);
TestDeserialization<TInstant, i64>(value, 100500);
TestDeserialization<TInstant, ui64>(value, 100500U);
- TestDeserialization<TInstant, TString>(value, "1970-01-01T00:01:40.500000");
+ TestDeserialization<TInstant, std::string>(value, "1970-01-01T00:01:40.500000");
}
{
TDuration value = TDuration::MilliSeconds(100500);
@@ -151,7 +151,7 @@ TEST(TCustomTypeSerializationTest, TInstant)
TestDeserialization<TDuration, double>(value, 100500.);
TestDeserialization<TDuration, i64>(value, 100500);
TestDeserialization<TDuration, ui64>(value, 100500U);
- TestDeserialization<TDuration, TString>(value, "100.5s");
+ TestDeserialization<TDuration, std::string>(value, "100.5s");
TestDeserialization<TDuration, double>(TDuration::MicroSeconds(500), 0.5);
}
@@ -182,7 +182,7 @@ TEST(TCustomTypeSerializationTest, Optional)
{
std::optional<int> value;
auto yson = ConvertToYsonString(value);
- EXPECT_EQ(TString("#"), yson.ToString());
+ EXPECT_EQ(std::string("#"), yson.ToString());
EXPECT_EQ(value, ConvertTo<std::optional<int>>(yson));
TestSerializationDeserialization(value);
}
@@ -242,7 +242,7 @@ TEST(TSerializationTest, Simple)
}
{
- TString value = "abacaba";
+ std::string value = "abacaba";
TestSerializationDeserialization(value);
}
@@ -252,8 +252,8 @@ TEST(TSerializationTest, Simple)
value = false;
TestSerializationDeserialization(value);
- TestDeserialization(true, TString("true"));
- TestDeserialization(false, TString("false"));
+ TestDeserialization(true, std::string("true"));
+ TestDeserialization(false, std::string("false"));
TestDeserialization(false, i64(0));
TestDeserialization(true, i64(1));
@@ -290,111 +290,111 @@ TEST(TSerializationTest, PackRefs)
TEST(TSerializationTest, Map)
{
- std::map<TString, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
+ std::map<std::string, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::MapFragment);
}
TEST(TSerializationTest, CompactMap)
{
- TCompactFlatMap<TString, size_t, 4> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
+ TCompactFlatMap<std::string, size_t, 4> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
TestSerializationDeserialization(original);
}
TEST(TSerializationTest, Set)
{
- std::set<TString> original{"First", "Second", "Third"};
+ std::set<std::string> original{"First", "Second", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, CompactFlatSet)
{
- TCompactFlatSet<TString, 4> original{"First", "Second", "Third"};
+ TCompactFlatSet<std::string, 4> original{"First", "Second", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, CompactSet)
{
- TCompactSet<TString, 4> original{"First", "Second", "Third"};
+ TCompactSet<std::string, 4> original{"First", "Second", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, MultiSet)
{
- std::multiset<TString> original{"First", "Second", "Third", "Second", "Third", "Third"};
+ std::multiset<std::string> original{"First", "Second", "Third", "Second", "Third", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, MultiMap)
{
- std::multimap<TString, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
+ std::multimap<std::string, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::MapFragment);
}
TEST(TSerializationTest, MultiMapErrorDuplicateKey)
{
- std::multimap<TString, size_t> original{{"First", 12U}, {"Second", 7883U}, {"First", 2U}, {"Second", 3U}};
+ std::multimap<std::string, size_t> original{{"First", 12U}, {"Second", 7883U}, {"First", 2U}, {"Second", 3U}};
auto yson = ConvertToYsonString(original);
EXPECT_THROW(ConvertTo<std::decay<decltype(original)>::type>(yson), std::exception);
}
TEST(TSerializationTest, UnorderedMap)
{
- std::unordered_map<TString, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
+ std::unordered_map<std::string, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::MapFragment);
}
TEST(TSerializationTest, UnorderedSet)
{
- const std::unordered_set<TString> original{"First", "Second", "Third"};
+ const std::unordered_set<std::string> original{"First", "Second", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, UnorderedMultiSet)
{
- const std::unordered_multiset<TString> original{"First", "Second", "Third", "Second", "Third", "Third"};
+ const std::unordered_multiset<std::string> original{"First", "Second", "Third", "Second", "Third", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, UnorderedMultiMap)
{
- const std::unordered_multimap<TString, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
+ const std::unordered_multimap<std::string, size_t> original{{"First", 12U}, {"Second", 7883U}, {"Third", 7U}};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::MapFragment);
}
TEST(TSerializationTest, UnorderedMultiMapErrorDuplicateKey)
{
- const std::unordered_multimap<TString, size_t> original{{"Second", 7883U}, {"Third", 7U}, {"Second", 7U}};
+ const std::unordered_multimap<std::string, size_t> original{{"Second", 7883U}, {"Third", 7U}, {"Second", 7U}};
auto yson = ConvertToYsonString(original);
EXPECT_THROW(ConvertTo<std::decay<decltype(original)>::type>(yson), std::exception);
}
TEST(TSerializationTest, Vector)
{
- const std::vector<TString> original{"First", "Second", "Third"};
+ const std::vector<std::string> original{"First", "Second", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, Deque)
{
- const std::deque<TString> original{"First", "Second", "Third"};
+ const std::deque<std::string> original{"First", "Second", "Third"};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, Pair)
{
- auto original = std::pair<size_t, TString>(1U, "Second");
+ auto original = std::pair<size_t, std::string>(1U, "Second");
TestSerializationDeserialization(original);
}
@@ -406,24 +406,24 @@ TEST(TSerializationTest, Atomic)
TEST(TSerializationTest, Array)
{
- std::array<TString, 4> original{{"One", "Two", "3", "4"}};
+ std::array<std::string, 4> original{{"One", "Two", "3", "4"}};
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, Tuple)
{
- auto original = std::tuple<int, TString, size_t>(43, "TString", 343U);
+ auto original = std::tuple<int, std::string, size_t>(43, "std::string", 343U);
TestSerializationDeserialization(original);
TestSerializationDeserialization(original, EYsonType::ListFragment);
}
TEST(TSerializationTest, VectorOfTuple)
{
- std::vector<std::tuple<int, TString, size_t>> original{
- std::tuple<int, TString, size_t>(43, "First", 343U),
- std::tuple<int, TString, size_t>(0, "Second", 7U),
- std::tuple<int, TString, size_t>(2323, "Third", 9U),
+ std::vector<std::tuple<int, std::string, size_t>> original{
+ std::tuple<int, std::string, size_t>(43, "First", 343U),
+ std::tuple<int, std::string, size_t>(0, "Second", 7U),
+ std::tuple<int, std::string, size_t>(2323, "Third", 9U),
};
TestSerializationDeserialization(original);
@@ -432,7 +432,7 @@ TEST(TSerializationTest, VectorOfTuple)
TEST(TSerializationTest, MapOnArray)
{
- std::map<TString, std::array<size_t, 3>> original{
+ std::map<std::string, std::array<size_t, 3>> original{
{"1", {{2112U, 4343U, 5445U}}},
{"22", {{54654U, 93U, 5U}}},
{"333", {{7U, 93U, 9U}}},
@@ -542,13 +542,13 @@ TEST(TSerializationTest, ProtobufRepeatedField)
TEST(TSerializationTest, ProtobufRepeatedPtrField)
{
- google::protobuf::RepeatedPtrField<TString> original;
+ google::protobuf::RepeatedPtrField<TProtoStringType> original;
original.Add("one");
original.Add("two");
original.Add("three");
auto node = ConvertToNode(original);
- auto deserialized = ConvertTo<google::protobuf::RepeatedPtrField<TString>>(node);
+ auto deserialized = ConvertTo<google::protobuf::RepeatedPtrField<TProtoStringType>>(node);
EXPECT_TRUE(std::ranges::equal(original, deserialized));
}
diff --git a/yt/yt/core/ytree/unittests/size_ut.cpp b/yt/yt/core/ytree/unittests/size_ut.cpp
index 04561f15cba..896633216d0 100644
--- a/yt/yt/core/ytree/unittests/size_ut.cpp
+++ b/yt/yt/core/ytree/unittests/size_ut.cpp
@@ -92,8 +92,8 @@ TEST(TYTreeSizeTest, Simple)
TEST(TYTreeSizeTest, Serialize)
{
- EXPECT_EQ(ToString(TSize(1)), TString{"1"});
- EXPECT_EQ(Format("|%v|", TSize(42)), TString{"|42|"});
+ EXPECT_EQ(ToString(TSize(1)), std::string{"1"});
+ EXPECT_EQ(Format("|%v|", TSize(42)), std::string{"|42|"});
{
TSize v;
diff --git a/yt/yt/core/ytree/unittests/tree_builder_ut.cpp b/yt/yt/core/ytree/unittests/tree_builder_ut.cpp
index 5c69d5b3f06..f0533f79353 100644
--- a/yt/yt/core/ytree/unittests/tree_builder_ut.cpp
+++ b/yt/yt/core/ytree/unittests/tree_builder_ut.cpp
@@ -25,7 +25,7 @@ public:
StrictMock<TMockYsonConsumer> Mock;
};
-TString NodeToYsonString(const INodePtr& node)
+std::string NodeToYsonString(const INodePtr& node)
{
TStringStream stringStream;
TYsonWriter writer(&stringStream, EYsonFormat::Text);
diff --git a/yt/yt/core/ytree/unittests/yson_schema_ut.cpp b/yt/yt/core/ytree/unittests/yson_schema_ut.cpp
index 14d9be868b0..3a59565ce3d 100644
--- a/yt/yt/core/ytree/unittests/yson_schema_ut.cpp
+++ b/yt/yt/core/ytree/unittests/yson_schema_ut.cpp
@@ -90,7 +90,7 @@ struct TTestSubStructWithPtrAndString
: public virtual TYsonStruct
{
TRefCountedEntityPtr MyPtr;
- TString MyStr;
+ std::string MyStr;
REGISTER_YSON_STRUCT(TTestSubStructWithPtrAndString);
@@ -107,12 +107,12 @@ struct TTestSubStructWithPtrAndString
struct TTestYsonStruct
: public TYsonStruct
{
- TString MyString;
+ std::string MyString;
std::string MyStdString;
TTestSubStructPtr Sub;
std::vector<TTestSubStructLite> SubList;
- std::vector<TString> MyStringList;
- std::unordered_map<TString, int> IntMap;
+ std::vector<std::string> MyStringList;
+ std::unordered_map<std::string, int> IntMap;
std::optional<i64> NullableInt;
ETestEnum MyEnum;
unsigned int MyUint;
@@ -256,8 +256,8 @@ struct TTestStructWithUndefinedType
struct TTestStructWithTuples
: public TYsonStruct
{
- std::tuple<TString, ui64, double> Tuple;
- std::pair<TString, TString> Pair;
+ std::tuple<std::string, ui64, double> Tuple;
+ std::pair<std::string, std::string> Pair;
REGISTER_YSON_STRUCT(TTestStructWithTuples)
@@ -271,7 +271,7 @@ struct TTestStructWithTuples
struct TTestStructWithArray
: public TYsonStruct
{
- std::array<TString, 3> StringArray;
+ std::array<std::string, 3> StringArray;
REGISTER_YSON_STRUCT(TTestStructWithArray)
@@ -281,14 +281,14 @@ struct TTestStructWithArray
}
};
-YT_DEFINE_STRONG_TYPEDEF(TStringTypedef, TString);
+YT_DEFINE_STRONG_TYPEDEF(TStringTypedef, std::string);
YT_DEFINE_STRONG_TYPEDEF(TIntTypedef, i64);
struct TTestStructWithStrongTypedef
: public TYsonStruct
{
TStringTypedef StringTypedef;
- TString String;
+ std::string String;
TIntTypedef IntTypedef;
i64 Int;
@@ -478,7 +478,7 @@ TEST(TYsonStructSchemaTest, TestYsonStructWithArray)
IMapNodePtr GetMember(IListNodePtr members, TStringBuf name)
{
for (auto child : members->GetChildren()) {
- if (child->AsMap()->template GetChildValueOrThrow<TString>("name") == name) {
+ if (child->AsMap()->template GetChildValueOrThrow<std::string>("name") == name) {
return child->AsMap();
}
}
@@ -493,19 +493,19 @@ INodePtr GetDefault(IMapNodePtr member, TStringBuf name)
bool SourceLocationContains(IMapNodePtr member, TStringBuf substring)
{
- return member->template GetChildValueOrThrow<TString>("source_location_file_name").Contains(substring);
+ return member->GetChildValueOrThrow<std::string>("source_location_file_name").contains(substring);
}
bool CppTypeNameContains(IMapNodePtr member, TStringBuf substring)
{
- return member->template GetChildValueOrThrow<TString>("cpp_type_name").Contains(substring);
+ return member->GetChildValueOrThrow<std::string>("cpp_type_name").contains(substring);
}
IMapNodePtr UnwrapMember(IMapNodePtr member)
{
return member
- ->template GetChildValueOrThrow<IMapNodePtr>("type")
- ->template GetChildValueOrThrow<IMapNodePtr>("item");
+ ->GetChildValueOrThrow<IMapNodePtr>("type")
+ ->GetChildValueOrThrow<IMapNodePtr>("item");
}
////////////////////////////////////////////////////////////////////////////////
@@ -516,13 +516,13 @@ TEST(TYsonStructSchemaTest, TestDefaultValues)
auto schema = GetSchema(New<TTestYsonStruct>(), {.AddDefaultValues = true});
auto description = Format("Schema: %v", ConvertToYsonString(schema, EYsonFormat::Pretty));
- EXPECT_EQ(GetDefault(schema, "my_enum")->GetValue<TString>(), "value1") << description;
+ EXPECT_EQ(GetDefault(schema, "my_enum")->GetValue<std::string>(), "value1") << description;
EXPECT_FALSE(GetDefault(schema, "my_std_string")) << description;
EXPECT_FALSE(GetDefault(schema, "nullable_int")) << description;
EXPECT_EQ(GetDefault(schema, "my_string_list")->GetType(), ENodeType::List) << description;
EXPECT_EQ(GetDefault(UnwrapMember(GetMember(schema->FindChild("members")->AsList(), "sub")), "my_uint")->GetValue<ui64>(), 0u) << description;
- EXPECT_EQ(GetDefault(schema, "sub")->AsMap()->template GetChildValueOrThrow<ui64>("my_uint"), 8u) << description;
+ EXPECT_EQ(GetDefault(schema, "sub")->AsMap()->GetChildValueOrThrow<ui64>("my_uint"), 8u) << description;
}
{
@@ -530,7 +530,7 @@ TEST(TYsonStructSchemaTest, TestDefaultValues)
auto description = Format("Schema: %v", ConvertToYsonString(schema, EYsonFormat::Pretty));
auto members = schema->FindChild("members")->AsList();
- EXPECT_EQ(GetDefault(UnwrapMember(GetMember(members, "my_message")), "string_field")->GetValue<TString>(), "string_field_default") << description;
+ EXPECT_EQ(GetDefault(UnwrapMember(GetMember(members, "my_message")), "string_field")->GetValue<std::string>(), "string_field_default") << description;
}
}
@@ -553,8 +553,8 @@ TEST(TYsonStructSchemaTest, TestSourceLocation)
EXPECT_TRUE(SourceLocationContains(schema, "yson_schema_ut.cpp")) << description;
auto subMember = GetMember(members, "sub")
- ->template GetChildValueOrThrow<IMapNodePtr>("type")
- ->template GetChildValueOrThrow<IMapNodePtr>("item");
+ ->GetChildValueOrThrow<IMapNodePtr>("type")
+ ->GetChildValueOrThrow<IMapNodePtr>("item");
EXPECT_TRUE(SourceLocationContains(subMember, "yson_schema_ut.cpp")) << description;
}
@@ -564,8 +564,8 @@ TEST(TYsonStructSchemaTest, TestSourceLocation)
auto members = schema->FindChild("members")->AsList();
auto subMember = GetMember(members, "my_message")
- ->template GetChildValueOrThrow<IMapNodePtr>("type")
- ->template GetChildValueOrThrow<IMapNodePtr>("item");
+ ->GetChildValueOrThrow<IMapNodePtr>("type")
+ ->GetChildValueOrThrow<IMapNodePtr>("item");
EXPECT_TRUE(SourceLocationContains(subMember, "test.proto")) << description;
}
}
@@ -586,27 +586,27 @@ TEST(TYsonStructSchemaTest, CppTypeName)
EXPECT_TRUE(CppTypeNameContains(GetMember(members, "my_enum"), "ETestEnum")) << description;
EXPECT_TRUE(
CppTypeNameContains(
- GetMember(members, "my_enum")->template GetChildValueOrThrow<IMapNodePtr>("type"),
+ GetMember(members, "my_enum")->GetChildValueOrThrow<IMapNodePtr>("type"),
"ETestEnum")) << description;
EXPECT_TRUE(
GetMember(members, "my_enum")
- ->template GetChildValueOrThrow<TString>("containing_struct_cpp_type_name")
- .Contains("TTestYsonStruct")) << description;
+ ->GetChildValueOrThrow<std::string>("containing_struct_cpp_type_name")
+ .contains("TTestYsonStruct")) << description;
EXPECT_TRUE(
CppTypeNameContains(
- GetMember(members, "nullable_int")->template GetChildValueOrThrow<IMapNodePtr>("type"),
+ GetMember(members, "nullable_int")->GetChildValueOrThrow<IMapNodePtr>("type"),
"optional")) << description;
EXPECT_TRUE(
CppTypeNameContains(
- GetMember(members, "sub_list")->template GetChildValueOrThrow<IMapNodePtr>("type"),
+ GetMember(members, "sub_list")->GetChildValueOrThrow<IMapNodePtr>("type"),
"vector")) << description;
EXPECT_TRUE(
CppTypeNameContains(
- GetMember(members, "sub")->template GetChildValueOrThrow<IMapNodePtr>("type"),
+ GetMember(members, "sub")->GetChildValueOrThrow<IMapNodePtr>("type"),
"TIntrusivePtr")) << description;
}
diff --git a/yt/yt/core/ytree/unittests/yson_struct_update_ut.cpp b/yt/yt/core/ytree/unittests/yson_struct_update_ut.cpp
index 88f99617afd..4c878bac487 100644
--- a/yt/yt/core/ytree/unittests/yson_struct_update_ut.cpp
+++ b/yt/yt/core/ytree/unittests/yson_struct_update_ut.cpp
@@ -13,7 +13,7 @@ using namespace NYson;
////////////////////////////////////////////////////////////////////////////////
template <class TSpecPtr>
-auto CreateSpec(const TString& specString)
+auto CreateSpec(const std::string& specString)
{
return ConvertTo<TSpecPtr>(TYsonString(specString));
}
@@ -118,7 +118,7 @@ struct TVanillaSpec
: public TYsonStruct
{
public:
- THashMap<TString, TVanillaTaskSpecPtr> Tasks;
+ THashMap<std::string, TVanillaTaskSpecPtr> Tasks;
REGISTER_YSON_STRUCT(TVanillaSpec);
@@ -269,16 +269,16 @@ TEST(TUpdateYsonStructTest, MapField)
{
TConfigurator<TVanillaSpec> parentConfigurator = configurator;
auto& mapConfigurator = parentConfigurator.MapField("tasks", &TVanillaSpec::Tasks)
- .ValidateOnAdded(BIND([] (const TString&, const TVanillaTaskSpecPtr&) {
+ .ValidateOnAdded(BIND([] (const std::string&, const TVanillaTaskSpecPtr&) {
THROW_ERROR_EXCEPTION("Non-fatal create exception");
}))
- .ValidateOnRemoved(BIND([] (const TString&, const TVanillaTaskSpecPtr&) {
+ .ValidateOnRemoved(BIND([] (const std::string&, const TVanillaTaskSpecPtr&) {
THROW_ERROR_EXCEPTION("Non-fatal remove exception");
}))
- .OnAdded(BIND([] (const TString&, const TVanillaTaskSpecPtr&) -> TConfigurator<TVanillaTaskSpec> {
+ .OnAdded(BIND([] (const std::string&, const TVanillaTaskSpecPtr&) -> TConfigurator<TVanillaTaskSpec> {
THROW_ERROR_EXCEPTION("Fatal create exception");
}))
- .OnRemoved(BIND([] (const TString&, const TVanillaTaskSpecPtr&) {
+ .OnRemoved(BIND([] (const std::string&, const TVanillaTaskSpecPtr&) {
THROW_ERROR_EXCEPTION("Fatal remove exception");
}));
@@ -343,17 +343,17 @@ TEST(TUpdateYsonStructTest, MapFieldCustomCreate)
TConfigurator<TVanillaSpec> parentConfigurator = configurator;
auto& mapConfigurator = parentConfigurator.MapField("tasks", &TVanillaSpec::Tasks)
- .ValidateOnAdded(BIND([] (const TString&, const TVanillaTaskSpecPtr& taskSpec) {
+ .ValidateOnAdded(BIND([] (const std::string&, const TVanillaTaskSpecPtr& taskSpec) {
THROW_ERROR_EXCEPTION_IF(
!taskSpec->Creatable,
"Non-fatal create exception");
}))
- .ValidateOnRemoved(BIND([] (const TString&, const TVanillaTaskSpecPtr& taskSpec) {
+ .ValidateOnRemoved(BIND([] (const std::string&, const TVanillaTaskSpecPtr& taskSpec) {
THROW_ERROR_EXCEPTION_IF(
!taskSpec->Removable,
"Non-fatal remove exception");
}))
- .OnAdded(BIND([&] (const TString&, const TVanillaTaskSpecPtr& taskSpec) -> TConfigurator<TVanillaTaskSpec> {
+ .OnAdded(BIND([&] (const std::string&, const TVanillaTaskSpecPtr& taskSpec) -> TConfigurator<TVanillaTaskSpec> {
THROW_ERROR_EXCEPTION_IF(
!taskSpec->Creatable,
"Fatal create exception");
@@ -361,7 +361,7 @@ TEST(TUpdateYsonStructTest, MapFieldCustomCreate)
thirdConfigured = true;
return configureChild(thirdCommand);
}))
- .OnRemoved(BIND([] (const TString&, const TVanillaTaskSpecPtr& taskSpec) {
+ .OnRemoved(BIND([] (const std::string&, const TVanillaTaskSpecPtr& taskSpec) {
THROW_ERROR_EXCEPTION_IF(
!taskSpec->Removable,
"Fatal remove exception");
diff --git a/yt/yt/core/ytree/unittests/yson_struct_ut.cpp b/yt/yt/core/ytree/unittests/yson_struct_ut.cpp
index bac580ce447..4a44efd5a26 100644
--- a/yt/yt/core/ytree/unittests/yson_struct_ut.cpp
+++ b/yt/yt/core/ytree/unittests/yson_struct_ut.cpp
@@ -46,7 +46,7 @@ struct TTestSubconfig
int MyInt;
unsigned int MyUint;
bool MyBool;
- std::vector<TString> MyStringList;
+ std::vector<std::string> MyStringList;
ETestEnum MyEnum;
TDuration MyDuration;
TSize MySize;
@@ -81,10 +81,10 @@ using TTestSubconfigPtr = TIntrusivePtr<TTestSubconfig>;
struct TTestConfig
: public TYsonStruct
{
- TString MyString;
+ std::string MyString;
TTestSubconfigPtr Subconfig;
std::vector<TTestSubconfigPtr> SubconfigList;
- std::unordered_map<TString, TTestSubconfigPtr> SubconfigMap;
+ std::unordered_map<std::string, TTestSubconfigPtr> SubconfigMap;
std::optional<i64> NullableInt;
REGISTER_YSON_STRUCT(TTestConfig);
@@ -416,7 +416,7 @@ TEST_P(TYsonStructParseTest, UnrecognizedSorted)
EXPECT_TRUE(AreNodesEqual(unrecognizedNode, unrecognizedRecursivelyNode));
EXPECT_EQ(3, unrecognizedNode->GetChildCount());
- TString expectedYson;
+ std::string expectedYson;
expectedYson += "{\"a_unrecognized\"=\"TestString\";";
expectedYson += "\"value\"=1337;";
expectedYson += "\"value_unrecognized\"=42;";
@@ -707,7 +707,7 @@ TEST(TYsonStructTest, SaveSingleParameter)
auto builder = CreateBuilderFromFactory(GetEphemeralNodeFactory());
builder->BeginTree();
config->SaveParameter("my_string", builder.get());
- auto actual = ConvertTo<TString>(builder->EndTree());
+ auto actual = ConvertTo<std::string>(builder->EndTree());
EXPECT_EQ("test", actual);
}
@@ -776,7 +776,7 @@ TEST(TYsonStructTest, Save)
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString subconfigYson =
+ std::string subconfigYson =
"{\"my_bool\"=%false;"
"\"my_enum\"=\"value1\";"
"\"my_int\"=200;"
@@ -785,7 +785,7 @@ TEST(TYsonStructTest, Save)
"\"my_duration\"=1000;"
"\"my_size\"=8000}";
- TString subconfigYsonOrigin =
+ std::string subconfigYsonOrigin =
"{\"my_bool\"=%false;"
"\"my_enum\"=\"value1\";"
"\"my_int\"=100;"
@@ -794,7 +794,7 @@ TEST(TYsonStructTest, Save)
"\"my_duration\"=1000;"
"\"my_size\"=8000}";
- TString expectedYson;
+ std::string expectedYson;
expectedYson += "{\"my_string\"=\"hello!\";";
expectedYson += "\"sub\"=" + subconfigYson + ";";
expectedYson += "\"sub_list\"=[" + subconfigYsonOrigin + "];";
@@ -1056,7 +1056,7 @@ struct TTestConfigWithManyFieldsFinal
: public TTestConfigWithManyFieldsDerived1
, public TTestConfigWithManyFieldsDerived2
{
- TString String;
+ std::string String;
REGISTER_YSON_STRUCT(TTestConfigWithManyFieldsFinal);
@@ -1110,7 +1110,7 @@ struct TTestConfigWithManyFieldsFinalLite
: public TTestConfigWithManyFieldsDerivedLite1
, public TTestConfigWithManyFieldsDerivedLite2
{
- TString String;
+ std::string String;
REGISTER_YSON_STRUCT_LITE(TTestConfigWithManyFieldsFinalLite);
@@ -1207,7 +1207,7 @@ class TTestConfigLite
: public TYsonStructLite
{
public:
- TString MyString;
+ std::string MyString;
std::optional<i64> NullableInt;
REGISTER_YSON_STRUCT_LITE(TTestConfigLite);
@@ -1228,7 +1228,7 @@ TEST(TYsonStructTest, SaveLite)
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson;
+ std::string expectedYson;
expectedYson += "{\"my_string\"=\"hello!\";";
expectedYson += "\"nullable_int\"=42}";
@@ -1249,7 +1249,7 @@ class TTestLiteWithDefaults
: public TYsonStructLite
{
public:
- TString MyString;
+ std::string MyString;
int MyInt;
TTestSubconfigPtr Subconfig;
@@ -1290,7 +1290,7 @@ class TTestConfigLiteWithFieldTracking
: public TYsonStructLiteWithFieldTracking
{
public:
- TString MyString;
+ std::string MyString;
std::optional<i64> NullableInt;
REGISTER_YSON_STRUCT_LITE(TTestConfigLiteWithFieldTracking);
@@ -1679,7 +1679,7 @@ class TTestConfigWithAliases
: public TYsonStruct
{
public:
- TString Value;
+ std::string Value;
REGISTER_YSON_STRUCT(TTestConfigWithAliases);
@@ -1779,14 +1779,14 @@ TEST(TYsonStructTest, Aliases5)
struct TTestConfigWithContainers
: public NYTree::TYsonStructLite
{
- std::vector<TString> Vector;
- std::array<TString, 3> Array;
- std::pair<size_t, TString> Pair;
- std::set<TString> Set;
- std::map<TString, int> Map;
+ std::vector<std::string> Vector;
+ std::array<std::string, 3> Array;
+ std::pair<size_t, std::string> Pair;
+ std::set<std::string> Set;
+ std::map<std::string, int> Map;
std::multiset<int> MultiSet;
- std::unordered_set<TString> UnorderedSet;
- std::unordered_map<TString, int> UnorderedMap;
+ std::unordered_set<std::string> UnorderedSet;
+ std::unordered_map<std::string, int> UnorderedMap;
std::unordered_multiset<size_t> UnorderedMultiSet;
REGISTER_YSON_STRUCT_LITE(TTestConfigWithContainers);
@@ -1846,11 +1846,11 @@ TEST(TYsonStructTest, ParameterTuplesAndContainers)
TEST(TYsonStructTest, EnumAsKeyToYHash)
{
- THashMap<ETestEnum, TString> deserialized, original = {
+ THashMap<ETestEnum, std::string> deserialized, original = {
{ETestEnum::Value0, "abc"}
};
- TString serialized = "{\"value0\"=\"abc\";}";
+ std::string serialized = "{\"value0\"=\"abc\";}";
EXPECT_EQ(serialized, ConvertToYsonString(original, EYsonFormat::Text).AsStringBuf());
Deserialize(deserialized, ConvertToNode(TYsonString(serialized, EYsonType::Node)));
@@ -1919,7 +1919,7 @@ TEST(TYsonStructTest, DontSerializeDefault)
auto config = New<TConfigWithDontSerializeDefault>();
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=123;}";
+ std::string expectedYson = "{\"value\"=123;}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
@@ -1930,7 +1930,7 @@ TEST(TYsonStructTest, DontSerializeDefault)
config->OtherValue = 789;
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=123;\"other_value\"=789;}";
+ std::string expectedYson = "{\"value\"=123;\"other_value\"=789;}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
@@ -1969,14 +1969,14 @@ TEST(TYsonStructTest, UniversalParameterAccessor)
config->NestedStruct.Value = 3;
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=3;}";
+ std::string expectedYson = "{\"value\"=3;}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
}
{
- TString sourceYson = "{\"value\"=3;}";
+ std::string sourceYson = "{\"value\"=3;}";
auto config = ConvertTo<TIntrusivePtr<TConfigWithUniversalParameterAccessor>>(TYsonString(TStringBuf(sourceYson)));
EXPECT_EQ(3, config->NestedStruct.Value);
@@ -2006,7 +2006,7 @@ TEST(TYsonStructTest, VirtualInheritance)
auto config = New<TVirtualInheritanceConfig>();
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=123;}";
+ std::string expectedYson = "{\"value\"=123;}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
@@ -2045,7 +2045,7 @@ TEST(TYsonStructTest, RegisterBaseFieldInDerived)
auto config = New<TDerived>();
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=123;}";
+ std::string expectedYson = "{\"value\"=123;}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
@@ -2078,7 +2078,7 @@ TEST(TYsonStructTest, ClassLevelPostprocess)
config->Value = 1;
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=1}";
+ std::string expectedYson = "{\"value\"=1}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
@@ -2118,7 +2118,7 @@ TEST(TYsonStructTest, RecursiveConfig)
config->Subconfig->Value = 3;
auto output = ConvertToYsonString(config, NYson::EYsonFormat::Text);
- TString expectedYson = "{\"value\"=1;\"subconfig\"={\"value\"=3}}";
+ std::string expectedYson = "{\"value\"=1;\"subconfig\"={\"value\"=3}}";
EXPECT_TRUE(AreNodesEqual(
ConvertToNode(TYsonString(expectedYson)),
ConvertToNode(TYsonString(output.AsStringBuf()))));
@@ -2293,7 +2293,7 @@ TEST(TYsonStructTest, TestComplexSerialization)
TTestConfigPtr Config1;
TTestConfigPtr Config2;
TTestConfigLite LiteConfig;
- TString StructName;
+ std::string StructName;
Y_SAVELOAD_DEFINE(Config1, Config2, LiteConfig, StructName);
};
@@ -2914,7 +2914,7 @@ class TTestSubConfigLiteWithDefaults
{
public:
int MyInt;
- TString MyString;
+ std::string MyString;
REGISTER_YSON_STRUCT_LITE(TTestSubConfigLiteWithDefaults);
@@ -3079,7 +3079,7 @@ class TTestingNestedMapWithCustomDefault
: public TYsonStruct
{
public:
- THashMap<TString, TIntrusivePtr<TSimpleYsonStruct>> NestedMap;
+ THashMap<std::string, TIntrusivePtr<TSimpleYsonStruct>> NestedMap;
REGISTER_YSON_STRUCT(TTestingNestedMapWithCustomDefault);
@@ -3087,7 +3087,7 @@ public:
{
registrar.Parameter("nested_map", &TThis::NestedMap)
.DefaultCtor([] {
- return THashMap<TString, TIntrusivePtr<TSimpleYsonStruct>>{
+ return THashMap<std::string, TIntrusivePtr<TSimpleYsonStruct>>{
{"foo", CreateSimpleYsonStruct(42)},
{"bar", CreateSimpleYsonStruct(7)},
};
@@ -3131,7 +3131,7 @@ class TTestingNestedMapWithCustomDefaultResetOnLoad
: public TYsonStruct
{
public:
- THashMap<TString, TIntrusivePtr<TSimpleYsonStruct>> NestedMap;
+ THashMap<std::string, TIntrusivePtr<TSimpleYsonStruct>> NestedMap;
REGISTER_YSON_STRUCT(TTestingNestedMapWithCustomDefaultResetOnLoad);
@@ -3139,7 +3139,7 @@ public:
{
registrar.Parameter("nested_map", &TThis::NestedMap)
.DefaultCtor([] {
- return THashMap<TString, TIntrusivePtr<TSimpleYsonStruct>>{
+ return THashMap<std::string, TIntrusivePtr<TSimpleYsonStruct>>{
{"foo", CreateSimpleYsonStruct(42)},
{"bar", CreateSimpleYsonStruct(7)},
};
@@ -4358,8 +4358,8 @@ TEST(TYsonStructTest, YsonStructLiteMoveAssign)
struct TTestYsonStructWithMap
: public TYsonStruct
{
- std::map<TString, TString> Map;
- std::map<TTestComplexKey, TString> ComplexMap;
+ std::map<std::string, std::string> Map;
+ std::map<TTestComplexKey, std::string> ComplexMap;
TTestComplexKey ComplexKey;
REGISTER_YSON_STRUCT(TTestYsonStructWithMap);
@@ -4482,11 +4482,11 @@ struct TTestYsonStructVisitor
: public TYsonStruct
{
int X;
- TString Y;
+ std::string Y;
TTestYsonStructVisitorSubPtr Sub;
TTestYsonStructVisitorSubLite SubLite;
- THashMap<TString, TTestYsonStructVisitorSubPtr> SubMap;
- std::tuple<int, TString, TTestYsonStructVisitorSubPtr> SubTuple;
+ THashMap<std::string, TTestYsonStructVisitorSubPtr> SubMap;
+ std::tuple<int, std::string, TTestYsonStructVisitorSubPtr> SubTuple;
TYsonStructVisitorPoly Poly;
REGISTER_YSON_STRUCT(TTestYsonStructVisitor);
@@ -4509,12 +4509,12 @@ struct TTestYsonStructVisitor
TEST(TestYsonStruct, Visitor)
{
- std::vector<std::pair<TString, bool>> visited;
+ std::vector<std::pair<std::string, bool>> visited;
auto visitor = [&](const auto& context) {
visited.emplace_back(context.Path, !context.Parameter->IsRequired());
};
TraverseYsonStruct<TTestYsonStructVisitor>(visitor);
- auto expected = std::vector<std::pair<TString, bool>>{
+ auto expected = std::vector<std::pair<std::string, bool>>{
{"/x", false},
{"/y", true},
{"/sub", false},
diff --git a/yt/yt/core/ytree/unittests/ytree_fluent_ut.cpp b/yt/yt/core/ytree/unittests/ytree_fluent_ut.cpp
index 8b2e9b89708..b79d4985479 100644
--- a/yt/yt/core/ytree/unittests/ytree_fluent_ut.cpp
+++ b/yt/yt/core/ytree/unittests/ytree_fluent_ut.cpp
@@ -37,7 +37,7 @@ TYPED_TEST_P(TYTreeFluentStringScalarTest, Ok)
.Value(passedScalar);
}
-using TYTreeFluentStringScalarTestTypes = Types<const char*, TString>;
+using TYTreeFluentStringScalarTestTypes = Types<const char*, std::string>;
REGISTER_TYPED_TEST_SUITE_P(TYTreeFluentStringScalarTest, Ok);
INSTANTIATE_TYPED_TEST_SUITE_P(
diff --git a/yt/yt/core/ytree/unittests/ytree_ut.cpp b/yt/yt/core/ytree/unittests/ytree_ut.cpp
index 0528d623cf5..cc005cb0c48 100644
--- a/yt/yt/core/ytree/unittests/ytree_ut.cpp
+++ b/yt/yt/core/ytree/unittests/ytree_ut.cpp
@@ -22,7 +22,7 @@ using NYT::ToProto;
void SyncYPathMultisetAttributes(
const IYPathServicePtr& service,
const TYPath& path,
- const std::vector<std::pair<TString, TYsonString>>& requests)
+ const std::vector<std::pair<std::string, TYsonString>>& requests)
{
auto multisetAttributesRequest = TYPathProxy::MultisetAttributes(path);
for (const auto& request : requests) {
@@ -36,13 +36,13 @@ void SyncYPathMultisetAttributes(
TEST(TYTreeTest, TestMultisetAttributes)
{
- std::vector<std::pair<TString, TYsonString>> attributes1 = {
+ std::vector<std::pair<std::string, TYsonString>> attributes1 = {
{"k1", TYsonString(TStringBuf("v1"))},
{"k2", TYsonString(TStringBuf("v2"))},
{"k3", TYsonString(TStringBuf("v3"))}
};
- std::vector<std::pair<TString, TYsonString>> attributes2 = {
+ std::vector<std::pair<std::string, TYsonString>> attributes2 = {
{"k2", TYsonString(TStringBuf("v4"))},
{"k3", TYsonString(TStringBuf("v5"))},
{"k4", TYsonString(TStringBuf("v6"))}
@@ -68,12 +68,12 @@ TEST(TYTreeTest, TestMultisetAttributes)
TEST(TYTreeTest, TestMultisetInvalidAttributes)
{
- std::vector<std::pair<TString, TYsonString>> validAttributes = {
+ std::vector<std::pair<std::string, TYsonString>> validAttributes = {
{"k1", TYsonString(TStringBuf("v1"))},
{"k2", TYsonString(TStringBuf("v2"))},
{"k3", TYsonString(TStringBuf("v3"))}
};
- std::vector<std::pair<TString, TYsonString>> invalidAttributes = {
+ std::vector<std::pair<std::string, TYsonString>> invalidAttributes = {
{"k1", TYsonString(TStringBuf("v1"))},
{"", TYsonString(TStringBuf("v2"))}, // Empty attributes are not allowed.
{"k3", TYsonString(TStringBuf("v3"))}
@@ -89,14 +89,14 @@ TEST(TYTreeTest, TestMultisetInvalidAttributes)
TEST(TYTreeTest, TestMultisetAttributesByPath)
{
- std::vector<std::pair<TString, TYsonString>> attributes1 = {
+ std::vector<std::pair<std::string, TYsonString>> attributes1 = {
{"a", TYsonString(TStringBuf("{}"))},
};
- std::vector<std::pair<TString, TYsonString>> attributes2 = {
+ std::vector<std::pair<std::string, TYsonString>> attributes2 = {
{"a/b", TYsonString(TStringBuf("v1"))},
{"a/c", TYsonString(TStringBuf("v2"))},
};
- std::vector<std::pair<TString, TYsonString>> attributes3 = {
+ std::vector<std::pair<std::string, TYsonString>> attributes3 = {
{"b", TYsonString(TStringBuf("v3"))},
{"c", TYsonString(TStringBuf("v4"))},
};
diff --git a/yt/yt/core/ytree/virtual-inl.h b/yt/yt/core/ytree/virtual-inl.h
index 6b24ab8306b..0a8d1d82498 100644
--- a/yt/yt/core/ytree/virtual-inl.h
+++ b/yt/yt/core/ytree/virtual-inl.h
@@ -9,18 +9,31 @@ namespace NYT::NYTree {
////////////////////////////////////////////////////////////////////////////////
template <class T>
-class TDefaultConversionTraits
+struct TDefaultConversionTraits
{ };
template <>
-class TDefaultConversionTraits<TString>
+struct TDefaultConversionTraits<std::string>
{
-public:
- static TString ConvertKeyToString(const TString& key)
+ static std::string ConvertKeyToString(const std::string& key)
{
return key;
}
+ static std::string ConvertStringToKey(TStringBuf key)
+ {
+ return std::string(key);
+ }
+};
+
+template <>
+struct TDefaultConversionTraits<TString>
+{
+ static std::string ConvertKeyToString(const TString& key)
+ {
+ return std::string(key);
+ }
+
static TString ConvertStringToKey(TStringBuf key)
{
return TString(key);
diff --git a/yt/yt/core/ytree/virtual.cpp b/yt/yt/core/ytree/virtual.cpp
index 4485a3542b3..d5f2091b01f 100644
--- a/yt/yt/core/ytree/virtual.cpp
+++ b/yt/yt/core/ytree/virtual.cpp
@@ -419,7 +419,7 @@ public:
return false;
}
- void AddChild(const TString& key, IYPathServicePtr service)
+ void AddChild(const std::string& key, IYPathServicePtr service)
{
YT_VERIFY(Services_.emplace(key, service).second);
}
@@ -430,7 +430,7 @@ public:
}
private:
- THashMap<TString, IYPathServicePtr> Services_;
+ THashMap<std::string, IYPathServicePtr> Services_;
THashMap<TInternedAttributeKey, TYsonCallback> Attributes_;
};
@@ -473,7 +473,7 @@ bool TCompositeMapService::GetBuiltinAttribute(TInternedAttributeKey key, NYson:
return TVirtualMapBase::GetBuiltinAttribute(key, consumer);
}
-TIntrusivePtr<TCompositeMapService> TCompositeMapService::AddChild(const TString& key, IYPathServicePtr service)
+TIntrusivePtr<TCompositeMapService> TCompositeMapService::AddChild(const std::string& key, IYPathServicePtr service)
{
Impl_->AddChild(key, std::move(service));
return this;
diff --git a/yt/yt/core/ytree/virtual.h b/yt/yt/core/ytree/virtual.h
index 151fb5e057b..3debd317f1d 100644
--- a/yt/yt/core/ytree/virtual.h
+++ b/yt/yt/core/ytree/virtual.h
@@ -89,7 +89,7 @@ public:
void ListSystemAttributes(std::vector<TAttributeDescriptor>* descriptors) override;
bool GetBuiltinAttribute(TInternedAttributeKey key, NYson::IYsonConsumer* consumer) override;
- TIntrusivePtr<TCompositeMapService> AddChild(const TString& key, IYPathServicePtr service);
+ TIntrusivePtr<TCompositeMapService> AddChild(const std::string& key, IYPathServicePtr service);
TIntrusivePtr<TCompositeMapService> AddAttribute(TInternedAttributeKey key, NYson::TYsonCallback producer);
private:
diff --git a/yt/yt/core/ytree/ypath_client.cpp b/yt/yt/core/ytree/ypath_client.cpp
index 436c7e7d58a..870ab06f778 100644
--- a/yt/yt/core/ytree/ypath_client.cpp
+++ b/yt/yt/core/ytree/ypath_client.cpp
@@ -272,7 +272,7 @@ TYPathMaybeRef GetRequestTargetYPath(const NRpc::NProto::TRequestHeader& header)
{
const auto& ypathExt = header.GetExtension(NProto::TYPathHeaderExt::ypath_header_ext);
// NB: If Arcadia protobuf is used, the cast is no-op `const TYPath&` -> `const TYPath&`.
- // If vanilla protobuf is used, the cast is `std::string` -> `TString`.
+ // If vanilla protobuf is used, the cast is `std::string` -> `std::string`.
// So in both cases the cast is correct and the most effective possible.
return TYPathMaybeRef(ypathExt.target_path());
}
@@ -477,7 +477,7 @@ std::string SyncYPathGetKey(const IYPathServicePtr& service, const TYPath& path)
auto future = ExecuteVerb(service, request);
auto optionalResult = future.AsUnique().TryGet();
YT_VERIFY(optionalResult);
- return FromProto<TString>(optionalResult->ValueOrThrow()->value());
+ return FromProto<std::string>(optionalResult->ValueOrThrow()->value());
}
TYsonString SyncYPathGet(
@@ -645,14 +645,14 @@ void SetNodeByYPath(
NYPath::TTokenizer tokenizer(path);
- TString currentToken;
- TString currentLiteralValue;
+ std::string currentToken;
+ std::string currentLiteralValue;
auto nextSegment = [&] {
tokenizer.Skip(NYPath::ETokenType::Ampersand);
tokenizer.Expect(NYPath::ETokenType::Slash);
tokenizer.Advance();
tokenizer.Expect(NYPath::ETokenType::Literal);
- currentToken = TString(tokenizer.GetToken());
+ currentToken = std::string(tokenizer.GetToken());
currentLiteralValue = tokenizer.GetLiteralValue();
};
@@ -746,14 +746,14 @@ void ForceYPath(
NYPath::TTokenizer tokenizer(path);
- TString currentToken;
- TString currentLiteralValue;
+ std::string currentToken;
+ std::string currentLiteralValue;
auto nextSegment = [&] {
tokenizer.Skip(NYPath::ETokenType::Ampersand);
tokenizer.Expect(NYPath::ETokenType::Slash);
tokenizer.Advance();
tokenizer.Expect(NYPath::ETokenType::Literal);
- currentToken = TString(tokenizer.GetToken());
+ currentToken = std::string(tokenizer.GetToken());
currentLiteralValue = tokenizer.GetLiteralValue();
};
diff --git a/yt/yt/core/ytree/ypath_client.h b/yt/yt/core/ytree/ypath_client.h
index 39f04e0e7b3..1ef318e4b43 100644
--- a/yt/yt/core/ytree/ypath_client.h
+++ b/yt/yt/core/ytree/ypath_client.h
@@ -217,8 +217,8 @@ protected:
// TODO(gritukan): It's not easy to find a proper return type for these functions
// that is suitable both for vanilla and patched protobufs. In an ideal world,
// it would be TYPathBuf, but for now it breaks the advantages for CoW of the
-// TString. Rethink it if and when YT will try to use std::string or non-CoW
-// TString everywhere.
+// std::string. Rethink it if and when YT will try to use std::string or non-CoW
+// std::string everywhere.
using TYPathMaybeRef = std::conditional_t<IsArcadiaProtobuf, const TYPath&, TYPath>;
TYPathMaybeRef GetRequestTargetYPath(const NRpc::NProto::TRequestHeader& header);
diff --git a/yt/yt/core/ytree/ypath_detail.cpp b/yt/yt/core/ytree/ypath_detail.cpp
index 67642a98189..c41fdcceac3 100644
--- a/yt/yt/core/ytree/ypath_detail.cpp
+++ b/yt/yt/core/ytree/ypath_detail.cpp
@@ -247,7 +247,7 @@ void TSupportsMultisetAttributes::SetAttributes(
Y_UNUSED(request);
Y_UNUSED(response);
Y_UNUSED(context);
- ThrowMethodNotSupported("MultisetAttributes", TString("attributes"));
+ ThrowMethodNotSupported("MultisetAttributes", std::string("attributes"));
}
////////////////////////////////////////////////////////////////////////////////
@@ -1177,7 +1177,7 @@ const THashSet<TInternedAttributeKey>& TSystemBuiltinAttributeKeysCache::GetBuil
////////////////////////////////////////////////////////////////////////////////
-const THashSet<TString>& TSystemCustomAttributeKeysCache::GetCustomAttributeKeys(
+const THashSet<std::string>& TSystemCustomAttributeKeysCache::GetCustomAttributeKeys(
ISystemAttributeProvider* provider)
{
if (!Initialized_) {
@@ -1201,7 +1201,7 @@ const THashSet<TString>& TSystemCustomAttributeKeysCache::GetCustomAttributeKeys
////////////////////////////////////////////////////////////////////////////////
-const THashSet<TString>& TOpaqueAttributeKeysCache::GetOpaqueAttributeKeys(
+const THashSet<std::string>& TOpaqueAttributeKeysCache::GetOpaqueAttributeKeys(
ISystemAttributeProvider* provider)
{
if (!Initialized_) {
@@ -1277,10 +1277,10 @@ class TNodeSetter
#define END_SETTER() \
};
-BEGIN_SETTER(String, TString)
+BEGIN_SETTER(String, std::string)
void OnMyStringScalar(TStringBuf value) override
{
- Node_->SetValue(TString(value));
+ Node_->SetValue(std::string(value));
}
END_SETTER()
@@ -1355,10 +1355,10 @@ private:
YT_VERIFY(TreeBuilder_);
TreeBuilder_->BeginTree();
- Forward(TreeBuilder_, std::bind(&TNodeSetter::OnForwardingFinished, this, TString(key)));
+ Forward(TreeBuilder_, std::bind(&TNodeSetter::OnForwardingFinished, this, std::string(key)));
}
- void OnForwardingFinished(TString itemKey)
+ void OnForwardingFinished(std::string itemKey)
{
if (!Map_->AddChild(itemKey, TreeBuilder_->EndTree())) {
THROW_ERROR_EXCEPTION("Duplicate key %Qv", itemKey);
@@ -1458,7 +1458,7 @@ private:
AttributeWriter_.reset(new TBufferedBinaryYsonWriter(&AttributeStream_));
Forward(
AttributeWriter_.get(),
- [this, key = TString(key)] {
+ [this, key = std::string(key)] {
AttributeWriter_->Flush();
AttributeWriter_.reset();
Attributes_->SetYson(key, TYsonString(AttributeStream_.Str()));
diff --git a/yt/yt/core/ytree/ypath_detail.h b/yt/yt/core/ytree/ypath_detail.h
index b5ea0d64180..59c63f92747 100644
--- a/yt/yt/core/ytree/ypath_detail.h
+++ b/yt/yt/core/ytree/ypath_detail.h
@@ -169,17 +169,17 @@ protected:
\
void TSupports##method::method##Attribute(const NYPath::TYPath& /*path*/, TReq##method* /*request*/, TRsp##method* /*response*/, const TCtx##method##Ptr& context) \
{ \
- ThrowMethodNotSupported(context->GetMethod(), TString("attribute")); \
+ ThrowMethodNotSupported(context->GetMethod(), std::string("attribute")); \
} \
\
void TSupports##method::method##Self(TReq##method* /*request*/, TRsp##method* /*response*/, const TCtx##method##Ptr& context) \
{ \
- ThrowMethodNotSupported(context->GetMethod(), TString("self")); \
+ ThrowMethodNotSupported(context->GetMethod(), std::string("self")); \
} \
\
void TSupports##method::method##Recursive(const NYPath::TYPath& /*path*/, TReq##method* /*request*/, TRsp##method* /*response*/, const TCtx##method##Ptr& context) \
{ \
- ThrowMethodNotSupported(context->GetMethod(), TString("recursive")); \
+ ThrowMethodNotSupported(context->GetMethod(), std::string("recursive")); \
}
////////////////////////////////////////////////////////////////////////////////
@@ -254,7 +254,7 @@ protected:
private:
TSupportsPermissions* const Owner_;
- THashMap<TString, EPermissionSet> ValidatedPermissions_;
+ THashMap<std::string, EPermissionSet> ValidatedPermissions_;
};
};
@@ -397,13 +397,13 @@ private:
class TSystemCustomAttributeKeysCache
{
public:
- const THashSet<TString>& GetCustomAttributeKeys(ISystemAttributeProvider* provider);
+ const THashSet<std::string>& GetCustomAttributeKeys(ISystemAttributeProvider* provider);
private:
std::atomic<bool> Initialized_ = false;
YT_DECLARE_SPIN_LOCK(NThreading::TSpinLock, InitializationLock_);
- THashSet<TString> CustomKeys_;
+ THashSet<std::string> CustomKeys_;
};
////////////////////////////////////////////////////////////////////////////////
@@ -411,13 +411,13 @@ private:
class TOpaqueAttributeKeysCache
{
public:
- const THashSet<TString>& GetOpaqueAttributeKeys(ISystemAttributeProvider* provider);
+ const THashSet<std::string>& GetOpaqueAttributeKeys(ISystemAttributeProvider* provider);
private:
std::atomic<bool> Initialized_ = false;
YT_DECLARE_SPIN_LOCK(NThreading::TSpinLock, InitializationLock_);
- THashSet<TString> OpaqueKeys_;
+ THashSet<std::string> OpaqueKeys_;
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/ytree/ypath_resolver.cpp b/yt/yt/core/ytree/ypath_resolver.cpp
index ebcad3fce61..fafb8afd8bf 100644
--- a/yt/yt/core/ytree/ypath_resolver.cpp
+++ b/yt/yt/core/ytree/ypath_resolver.cpp
@@ -32,7 +32,7 @@ DEFINE_ENUM(EExpectedItem,
(Value)
);
-using TResult = std::variant<bool, i64, ui64, double, TString>;
+using TResult = std::variant<bool, i64, ui64, double, std::string>;
std::optional<TResult> TryParseValue(TYsonPullParserCursor* cursor)
{
@@ -46,7 +46,7 @@ std::optional<TResult> TryParseValue(TYsonPullParserCursor* cursor)
case EYsonItemType::DoubleValue:
return (*cursor)->UncheckedAsDouble();
case EYsonItemType::StringValue:
- return TString((*cursor)->UncheckedAsString());
+ return std::string((*cursor)->UncheckedAsString());
default:
return std::nullopt;
}
@@ -67,7 +67,7 @@ TResult ParseValue(TYsonPullParserCursor* cursor)
tokenizer.GetInput());
}
-std::pair<EExpectedItem, std::optional<TString>> NextToken(TTokenizer* tokenizer)
+std::pair<EExpectedItem, std::optional<std::string>> NextToken(TTokenizer* tokenizer)
{
switch (tokenizer->Advance()) {
case ETokenType::EndOfStream:
@@ -173,12 +173,24 @@ struct TScalarTypeTraits
{ };
template <>
+struct TScalarTypeTraits<std::string>
+{
+ static std::optional<std::string> TryCast(const NDetail::TResult& result)
+ {
+ if (const auto* value = std::get_if<std::string>(&result)) {
+ return *value;
+ }
+ return std::nullopt;
+ }
+};
+
+template <>
struct TScalarTypeTraits<TString>
{
static std::optional<TString> TryCast(const NDetail::TResult& result)
{
- if (const auto* value = std::get_if<TString>(&result)) {
- return *value;
+ if (const auto* value = std::get_if<std::string>(&result)) {
+ return TString(*value);
}
return std::nullopt;
}
@@ -274,6 +286,7 @@ template std::optional<i64> TryGetValue<i64>(TStringBuf yson, const TYPath& ypat
template std::optional<ui64> TryGetValue<ui64>(TStringBuf yson, const TYPath& ypath);
template std::optional<bool> TryGetValue<bool>(TStringBuf yson, const TYPath& ypath);
template std::optional<double> TryGetValue<double>(TStringBuf yson, const TYPath& ypath);
+template std::optional<std::string> TryGetValue<std::string>(TStringBuf yson, const TYPath& ypath);
template std::optional<TString> TryGetValue<TString>(TStringBuf yson, const TYPath& ypath);
////////////////////////////////////////////////////////////////////////////////
@@ -298,14 +311,14 @@ std::optional<double> TryGetDouble(TStringBuf yson, const TYPath& ypath)
return TryGetValueImpl<double>(yson, ypath);
}
-std::optional<TString> TryGetString(TStringBuf yson, const TYPath& ypath)
+std::optional<std::string> TryGetString(TStringBuf yson, const TYPath& ypath)
{
- return TryGetValueImpl<TString>(yson, ypath);
+ return TryGetValueImpl<std::string>(yson, ypath);
}
-std::optional<TString> TryGetAny(TStringBuf yson, const TYPath& ypath)
+std::optional<std::string> TryGetAny(TStringBuf yson, const TYPath& ypath)
{
- return TryGetValueImpl<TString>(yson, ypath, /*isAny*/ true);
+ return TryGetValueImpl<std::string>(yson, ypath, /*isAny*/ true);
}
////////////////////////////////////////////////////////////////////////////////
@@ -321,6 +334,7 @@ template std::optional<i64> TryParseValue<i64>(TYsonPullParserCursor* cursor);
template std::optional<ui64> TryParseValue<ui64>(TYsonPullParserCursor* cursor);
template std::optional<bool> TryParseValue<bool>(TYsonPullParserCursor* cursor);
template std::optional<double> TryParseValue<double>(TYsonPullParserCursor* cursor);
+template std::optional<std::string> TryParseValue<std::string>(TYsonPullParserCursor* cursor);
template std::optional<TString> TryParseValue<TString>(TYsonPullParserCursor* cursor);
////////////////////////////////////////////////////////////////////////////////
@@ -360,7 +374,7 @@ bool ParseMapOrAttributesUntilKey(TYsonPullParserCursor* cursor, TStringBuf key)
return false;
}
-TString ParseAnyValue(TYsonPullParserCursor* cursor)
+std::string ParseAnyValue(TYsonPullParserCursor* cursor)
{
TStringStream stream;
{
diff --git a/yt/yt/core/ytree/ypath_resolver.h b/yt/yt/core/ytree/ypath_resolver.h
index 0cf3167c6b6..068783614de 100644
--- a/yt/yt/core/ytree/ypath_resolver.h
+++ b/yt/yt/core/ytree/ypath_resolver.h
@@ -16,8 +16,8 @@ std::optional<i64> TryGetInt64(TStringBuf yson, const NYPath::TYPath& ypath);
std::optional<ui64> TryGetUint64(TStringBuf yson, const NYPath::TYPath& ypath);
std::optional<bool> TryGetBoolean(TStringBuf yson, const NYPath::TYPath& ypath);
std::optional<double> TryGetDouble(TStringBuf yson, const NYPath::TYPath& ypath);
-std::optional<TString> TryGetString(TStringBuf yson, const NYPath::TYPath& ypath);
-std::optional<TString> TryGetAny(TStringBuf yson, const NYPath::TYPath& ypath);
+std::optional<std::string> TryGetString(TStringBuf yson, const NYPath::TYPath& ypath);
+std::optional<std::string> TryGetAny(TStringBuf yson, const NYPath::TYPath& ypath);
template <class T>
std::optional<T> TryParseValue(NYson::TYsonPullParserCursor* cursor);
@@ -26,7 +26,7 @@ std::optional<T> TryParseValue(NYson::TYsonPullParserCursor* cursor);
bool ParseListUntilIndex(NYson::TYsonPullParserCursor* cursor, int targetIndex);
bool ParseMapOrAttributesUntilKey(NYson::TYsonPullParserCursor* cursor, TStringBuf key);
-TString ParseAnyValue(NYson::TYsonPullParserCursor* cursor);
+std::string ParseAnyValue(NYson::TYsonPullParserCursor* cursor);
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/ytree/ypath_service.cpp b/yt/yt/core/ytree/ypath_service.cpp
index 553ffe34bbf..3d3e4185617 100644
--- a/yt/yt/core/ytree/ypath_service.cpp
+++ b/yt/yt/core/ytree/ypath_service.cpp
@@ -96,7 +96,7 @@ using namespace NConcurrency;
////////////////////////////////////////////////////////////////////////////////
-void CheckProducedNonEmptyData(const TString& data)
+void CheckProducedNonEmptyData(const std::string& data)
{
if (data.empty()) {
THROW_ERROR_EXCEPTION(
diff --git a/yt/yt/core/ytree/yson_schema-inl.h b/yt/yt/core/ytree/yson_schema-inl.h
index 363a81c7220..1c3583da4a1 100644
--- a/yt/yt/core/ytree/yson_schema-inl.h
+++ b/yt/yt/core/ytree/yson_schema-inl.h
@@ -166,7 +166,7 @@ void WriteSchema(NYson::IYsonConsumer* consumer, const TYsonStructWriteSchemaOpt
template <CProtobufMessageAsString T>
void WriteSchema(NYson::IYsonConsumer* consumer, const TYsonStructWriteSchemaOptions& options)
{
- return WriteSchema<TString>(consumer, options);
+ return WriteSchema<std::string>(consumer, options);
}
template <CYsonStructDerived T>
diff --git a/yt/yt/core/ytree/yson_struct_update-inl.h b/yt/yt/core/ytree/yson_struct_update-inl.h
index f0f5c576f32..e1830a04c80 100644
--- a/yt/yt/core/ytree/yson_struct_update-inl.h
+++ b/yt/yt/core/ytree/yson_struct_update-inl.h
@@ -381,7 +381,7 @@ NDetail::TFieldConfigurator<TValue>& TConfigurator<TStruct>::Field(const std::st
template <CYsonStructDerived TStruct>
template <class TValue>
-NDetail::TMapFieldConfigurator<TValue>& TConfigurator<TStruct>::MapField(const TString& name, TYsonStructField<TStruct, TValue> field)
+NDetail::TMapFieldConfigurator<TValue>& TConfigurator<TStruct>::MapField(const std::string& name, TYsonStructField<TStruct, TValue> field)
{
IYsonStructParameterPtr parameter;
diff --git a/yt/yt/core/ytree/yson_struct_update.h b/yt/yt/core/ytree/yson_struct_update.h
index 393e104b913..b3a682ec1d9 100644
--- a/yt/yt/core/ytree/yson_struct_update.h
+++ b/yt/yt/core/ytree/yson_struct_update.h
@@ -189,7 +189,7 @@ public:
NDetail::TFieldConfigurator<TValue>& Field(const std::string& name, TYsonStructField<TStruct, TValue> field);
template <class TValue>
- NDetail::TMapFieldConfigurator<TValue>& MapField(const TString& name, TYsonStructField<TStruct, TValue> field);
+ NDetail::TMapFieldConfigurator<TValue>& MapField(const std::string& name, TYsonStructField<TStruct, TValue> field);
// Converts to a configurator of a base class
template <class TAncestor>
diff --git a/yt/yt/library/skiff_ext/schema_match.cpp b/yt/yt/library/skiff_ext/schema_match.cpp
index 542296e75d3..c8a10f5c0fc 100644
--- a/yt/yt/library/skiff_ext/schema_match.cpp
+++ b/yt/yt/library/skiff_ext/schema_match.cpp
@@ -238,12 +238,12 @@ std::shared_ptr<TSkiffSchema> ParseSchema(
const INodePtr& schemaNode,
const IMapNodePtr& registry,
THashMap<TString, std::shared_ptr<TSkiffSchema>>* parsedRegistry,
- THashSet<TString>* parseInProgressNames)
+ THashSet<std::string>* parseInProgressNames)
{
auto schemaNodeType = schemaNode->GetType();
if (schemaNodeType == ENodeType::String) {
auto name = schemaNode->AsString()->GetValue();
- if (!name.StartsWith(ReferencePrefix)) {
+ if (!name.starts_with(ReferencePrefix)) {
THROW_ERROR_EXCEPTION(
"Invalid reference %Qv, reference must start with %Qv",
name,
@@ -318,7 +318,7 @@ std::vector<std::shared_ptr<TSkiffSchema>> ParseSkiffSchemas(
THashMap<TString, std::shared_ptr<TSkiffSchema>> parsedRegistry;
std::vector<std::shared_ptr<TSkiffSchema>> result;
for (const auto& node : tableSkiffSchemas->GetChildren()) {
- THashSet<TString> parseInProgressNames;
+ THashSet<std::string> parseInProgressNames;
auto skiffSchema = ParseSchema(node, skiffSchemaRegistry, &parsedRegistry, &parseInProgressNames);
result.push_back(skiffSchema);
}