aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2025-02-23 00:51:45 +0000
committerAlexander Smirnov <alex@ydb.tech>2025-02-23 00:51:45 +0000
commit92c53fa8f6f68034c47921d71d94608d769790c7 (patch)
tree9699426f0696e3cd63542c7ffb8ca1db7213406b
parent68803c1896c016d643b7b5b8d45b2bc5bb829942 (diff)
parent33fd3a38939d03482d5cc81b8db3e0e3e866b66c (diff)
downloadydb-92c53fa8f6f68034c47921d71d94608d769790c7.tar.gz
Merge branch 'rightlib' into merge-libs-250223-0050
-rw-r--r--library/cpp/tld/tlds-alpha-by-domain.txt2
-rw-r--r--library/cpp/yt/backtrace/backtrace.cpp4
-rw-r--r--library/cpp/yt/backtrace/backtrace.h2
-rw-r--r--library/cpp/yt/coding/unittests/varint_ut.cpp57
-rw-r--r--library/cpp/yt/compact_containers/unittests/compact_vector_ut.cpp12
-rw-r--r--library/cpp/yt/error/error-inl.h6
-rw-r--r--library/cpp/yt/error/error.cpp33
-rw-r--r--library/cpp/yt/error/error.h12
-rw-r--r--library/cpp/yt/error/error_attributes-inl.h3
-rw-r--r--library/cpp/yt/error/error_attributes.h2
-rw-r--r--library/cpp/yt/error/error_code.cpp16
-rw-r--r--library/cpp/yt/error/error_code.h12
-rw-r--r--library/cpp/yt/error/origin_attributes.cpp4
-rw-r--r--library/cpp/yt/error/origin_attributes.h2
-rw-r--r--library/cpp/yt/error/text_yson.cpp12
-rw-r--r--library/cpp/yt/error/unittests/error_code_ut.cpp4
-rw-r--r--library/cpp/yt/error/unittests/error_ut.cpp38
-rw-r--r--library/cpp/yt/exception/exception.cpp6
-rw-r--r--library/cpp/yt/exception/exception.h10
-rw-r--r--library/cpp/yt/logging/backends/stream/stream_log_manager.cpp2
-rw-r--r--library/cpp/yt/logging/logger.h4
-rw-r--r--library/cpp/yt/misc/guid.cpp4
-rw-r--r--library/cpp/yt/misc/thread_name.cpp2
-rw-r--r--library/cpp/yt/misc/thread_name.h2
-rw-r--r--library/cpp/yt/string/enum-inl.h2
-rw-r--r--library/cpp/yt/string/enum.cpp8
-rw-r--r--library/cpp/yt/string/enum.h8
-rw-r--r--library/cpp/yt/string/string.cpp4
-rw-r--r--library/cpp/yt/string/string.h5
-rw-r--r--library/cpp/yt/string/unittests/guid_ut.cpp4
-rw-r--r--yt/yql/providers/yt/comp_nodes/dq/dq_yt_block_reader.cpp2
-rw-r--r--yt/yt/client/api/operation_client.h8
-rw-r--r--yt/yt/client/object_client/helpers.cpp6
-rw-r--r--yt/yt/client/object_client/helpers.h2
-rw-r--r--yt/yt/client/security_client/acl.cpp2
-rw-r--r--yt/yt/client/security_client/acl.h6
-rw-r--r--yt/yt/client/security_client/helpers.cpp8
-rw-r--r--yt/yt/client/security_client/helpers.h6
-rw-r--r--yt/yt/client/ypath/rich.cpp3
-rw-r--r--yt/yt/core/logging/config.h8
-rw-r--r--yt/yt/core/logging/log_manager.cpp8
-rw-r--r--yt/yt/core/misc/configurable_singleton_def-inl.h3
-rw-r--r--yt/yt/core/rpc/service_detail.cpp5
-rw-r--r--yt/yt/core/rpc/service_detail.h4
-rw-r--r--yt/yt/core/ytree/attributes.cpp6
-rw-r--r--yt/yt/core/ytree/yson_struct-inl.h3
46 files changed, 180 insertions, 182 deletions
diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt
index c3968f49e2..fc48570eaf 100644
--- a/library/cpp/tld/tlds-alpha-by-domain.txt
+++ b/library/cpp/tld/tlds-alpha-by-domain.txt
@@ -1,4 +1,4 @@
-# Version 2025021300, Last Updated Thu Feb 13 07:07:02 2025 UTC
+# Version 2025022200, Last Updated Sat Feb 22 07:07:01 2025 UTC
AAA
AARP
ABB
diff --git a/library/cpp/yt/backtrace/backtrace.cpp b/library/cpp/yt/backtrace/backtrace.cpp
index 153a0a5dd0..e663cbb8a4 100644
--- a/library/cpp/yt/backtrace/backtrace.cpp
+++ b/library/cpp/yt/backtrace/backtrace.cpp
@@ -4,9 +4,9 @@ namespace NYT::NBacktrace {
////////////////////////////////////////////////////////////////////////////////
-TString SymbolizeBacktrace(TBacktrace backtrace)
+std::string SymbolizeBacktrace(TBacktrace backtrace)
{
- TString result;
+ std::string result;
SymbolizeBacktrace(
backtrace,
[&] (TStringBuf str) { result += str; });
diff --git a/library/cpp/yt/backtrace/backtrace.h b/library/cpp/yt/backtrace/backtrace.h
index ea70d9558c..fcb1dc782f 100644
--- a/library/cpp/yt/backtrace/backtrace.h
+++ b/library/cpp/yt/backtrace/backtrace.h
@@ -34,7 +34,7 @@ void SymbolizeBacktrace(
/*!
* \param backtrace Backtrace to symbolize
*/
-TString SymbolizeBacktrace(TBacktrace backtrace);
+std::string SymbolizeBacktrace(TBacktrace backtrace);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/coding/unittests/varint_ut.cpp b/library/cpp/yt/coding/unittests/varint_ut.cpp
index ed83ab5c92..cb6a800311 100644
--- a/library/cpp/yt/coding/unittests/varint_ut.cpp
+++ b/library/cpp/yt/coding/unittests/varint_ut.cpp
@@ -15,13 +15,14 @@ using ::testing::Values;
////////////////////////////////////////////////////////////////////////////////
-class TWriteVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, TString> >
+class TWriteVarIntTest
+ : public ::testing::TestWithParam<std::tuple<ui64, std::string>>
{ };
TEST_P(TWriteVarIntTest, Serialization)
{
ui64 value = std::get<0>(GetParam());
- TString rightAnswer = std::get<1>(GetParam());
+ std::string rightAnswer = std::get<1>(GetParam());
TStringStream outputStream;
WriteVarUint64(&outputStream, value);
@@ -30,13 +31,13 @@ TEST_P(TWriteVarIntTest, Serialization)
////////////////////////////////////////////////////////////////////////////////
-class TReadVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, TString> >
+class TReadVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, std::string> >
{ };
TEST_P(TReadVarIntTest, Serialization)
{
ui64 rightAnswer = std::get<0>(GetParam());
- TString input = std::get<1>(GetParam());
+ auto input = TString(std::get<1>(GetParam()));
TStringInput inputStream(input);
ui64 value;
@@ -56,34 +57,34 @@ TEST(TReadVarIntTest, Overflow)
auto ValuesForVarIntTests = Values(
// Simple cases.
- std::make_tuple(0x0ull, TString("\x00", 1)),
- std::make_tuple(0x1ull, TString("\x01", 1)),
- std::make_tuple(0x2ull, TString("\x02", 1)),
- std::make_tuple(0x3ull, TString("\x03", 1)),
- std::make_tuple(0x4ull, TString("\x04", 1)),
+ std::make_tuple(0x0ull, std::string("\x00", 1)),
+ std::make_tuple(0x1ull, std::string("\x01", 1)),
+ std::make_tuple(0x2ull, std::string("\x02", 1)),
+ std::make_tuple(0x3ull, std::string("\x03", 1)),
+ std::make_tuple(0x4ull, std::string("\x04", 1)),
// The following "magic numbers" are critical points for varint encoding.
- std::make_tuple((1ull << 7) - 1, TString("\x7f", 1)),
- std::make_tuple((1ull << 7), TString("\x80\x01", 2)),
- std::make_tuple((1ull << 14) - 1, TString("\xff\x7f", 2)),
- std::make_tuple((1ull << 14), TString("\x80\x80\x01", 3)),
- std::make_tuple((1ull << 21) - 1, TString("\xff\xff\x7f", 3)),
- std::make_tuple((1ull << 21), TString("\x80\x80\x80\x01", 4)),
- std::make_tuple((1ull << 28) - 1, TString("\xff\xff\xff\x7f", 4)),
- std::make_tuple((1ull << 28), TString("\x80\x80\x80\x80\x01", 5)),
- std::make_tuple((1ull << 35) - 1, TString("\xff\xff\xff\xff\x7f", 5)),
- std::make_tuple((1ull << 35), TString("\x80\x80\x80\x80\x80\x01", 6)),
- std::make_tuple((1ull << 42) - 1, TString("\xff\xff\xff\xff\xff\x7f", 6)),
- std::make_tuple((1ull << 42), TString("\x80\x80\x80\x80\x80\x80\x01", 7)),
- std::make_tuple((1ull << 49) - 1, TString("\xff\xff\xff\xff\xff\xff\x7f", 7)),
- std::make_tuple((1ull << 49), TString("\x80\x80\x80\x80\x80\x80\x80\x01", 8)),
- std::make_tuple((1ull << 56) - 1, TString("\xff\xff\xff\xff\xff\xff\xff\x7f", 8)),
- std::make_tuple((1ull << 56), TString("\x80\x80\x80\x80\x80\x80\x80\x80\x01", 9)),
- std::make_tuple((1ull << 63) - 1, TString("\xff\xff\xff\xff\xff\xff\xff\xff\x7f", 9)),
- std::make_tuple((1ull << 63), TString("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01", 10)),
+ std::make_tuple((1ull << 7) - 1, std::string("\x7f", 1)),
+ std::make_tuple((1ull << 7), std::string("\x80\x01", 2)),
+ std::make_tuple((1ull << 14) - 1, std::string("\xff\x7f", 2)),
+ std::make_tuple((1ull << 14), std::string("\x80\x80\x01", 3)),
+ std::make_tuple((1ull << 21) - 1, std::string("\xff\xff\x7f", 3)),
+ std::make_tuple((1ull << 21), std::string("\x80\x80\x80\x01", 4)),
+ std::make_tuple((1ull << 28) - 1, std::string("\xff\xff\xff\x7f", 4)),
+ std::make_tuple((1ull << 28), std::string("\x80\x80\x80\x80\x01", 5)),
+ std::make_tuple((1ull << 35) - 1, std::string("\xff\xff\xff\xff\x7f", 5)),
+ std::make_tuple((1ull << 35), std::string("\x80\x80\x80\x80\x80\x01", 6)),
+ std::make_tuple((1ull << 42) - 1, std::string("\xff\xff\xff\xff\xff\x7f", 6)),
+ std::make_tuple((1ull << 42), std::string("\x80\x80\x80\x80\x80\x80\x01", 7)),
+ std::make_tuple((1ull << 49) - 1, std::string("\xff\xff\xff\xff\xff\xff\x7f", 7)),
+ std::make_tuple((1ull << 49), std::string("\x80\x80\x80\x80\x80\x80\x80\x01", 8)),
+ std::make_tuple((1ull << 56) - 1, std::string("\xff\xff\xff\xff\xff\xff\xff\x7f", 8)),
+ std::make_tuple((1ull << 56), std::string("\x80\x80\x80\x80\x80\x80\x80\x80\x01", 9)),
+ std::make_tuple((1ull << 63) - 1, std::string("\xff\xff\xff\xff\xff\xff\xff\xff\x7f", 9)),
+ std::make_tuple((1ull << 63), std::string("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01", 10)),
// Boundary case.
- std::make_tuple(static_cast<ui64>(-1), TString("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 10))
+ std::make_tuple(static_cast<ui64>(-1), std::string("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 10))
);
INSTANTIATE_TEST_SUITE_P(ValueParametrized, TWriteVarIntTest,
diff --git a/library/cpp/yt/compact_containers/unittests/compact_vector_ut.cpp b/library/cpp/yt/compact_containers/unittests/compact_vector_ut.cpp
index 5ffc04efdc..fc40f6fdbe 100644
--- a/library/cpp/yt/compact_containers/unittests/compact_vector_ut.cpp
+++ b/library/cpp/yt/compact_containers/unittests/compact_vector_ut.cpp
@@ -273,7 +273,7 @@ TYPED_TEST(CompactVectorTest, InsertEnd)
{
SCOPED_TRACE("InsertEnd");
- TCompactVector<TString, 5> vector;
+ TCompactVector<std::string, 5> vector;
for (int index = 0; index < 10; ++index) {
vector.insert(vector.end(), ToString(index));
}
@@ -286,7 +286,7 @@ TYPED_TEST(CompactVectorTest, ShrinkToSmall)
{
SCOPED_TRACE("ShrinkToSmall");
- TCompactVector<TString, 5> vector;
+ TCompactVector<std::string, 5> vector;
for (int index = 0; index < 10; ++index) {
vector.shrink_to_small();
vector.push_back(ToString(index));
@@ -1061,8 +1061,8 @@ TEST(CompactVectorTest, InitializerList) {
}
TEST(CompactVectorTest, AssignToShorter) {
- TCompactVector<TString, 4> lhs;
- TCompactVector<TString, 4> rhs;
+ TCompactVector<std::string, 4> lhs;
+ TCompactVector<std::string, 4> rhs;
rhs.emplace_back("foo");
lhs = rhs;
EXPECT_EQ(1U, lhs.size());
@@ -1070,10 +1070,10 @@ TEST(CompactVectorTest, AssignToShorter) {
}
TEST(CompactVectorTest, AssignToLonger) {
- TCompactVector<TString, 4> lhs;
+ TCompactVector<std::string, 4> lhs;
lhs.emplace_back("bar");
lhs.emplace_back("baz");
- TCompactVector<TString, 4> rhs;
+ TCompactVector<std::string, 4> rhs;
rhs.emplace_back("foo");
lhs = rhs;
EXPECT_EQ(1U, lhs.size());
diff --git a/library/cpp/yt/error/error-inl.h b/library/cpp/yt/error/error-inl.h
index f82b8eb20d..6329528f02 100644
--- a/library/cpp/yt/error/error-inl.h
+++ b/library/cpp/yt/error/error-inl.h
@@ -55,14 +55,14 @@ constexpr bool TErrorCode::operator == (TErrorCode rhs) const
namespace NDetail {
template <class... TArgs>
-TString FormatErrorMessage(TStringBuf format, TArgs&&... args)
+std::string FormatErrorMessage(TStringBuf format, TArgs&&... args)
{
return Format(TRuntimeFormat{format}, std::forward<TArgs>(args)...);
}
-inline TString FormatErrorMessage(TStringBuf format)
+inline std::string FormatErrorMessage(TStringBuf format)
{
- return TString(format);
+ return std::string(format);
}
} // namespace NDetail
diff --git a/library/cpp/yt/error/error.cpp b/library/cpp/yt/error/error.cpp
index 4790fbf606..636d7d81fc 100644
--- a/library/cpp/yt/error/error.cpp
+++ b/library/cpp/yt/error/error.cpp
@@ -46,14 +46,14 @@ public:
, InnerErrors_(other.InnerErrors_)
{ }
- explicit TImpl(TString message)
+ explicit TImpl(std::string message)
: Code_(NYT::EErrorCode::Generic)
, Message_(std::move(message))
{
OriginAttributes_.Capture();
}
- TImpl(TErrorCode code, TString message)
+ TImpl(TErrorCode code, std::string message)
: Code_(code)
, Message_(std::move(message))
{
@@ -77,12 +77,12 @@ public:
Code_ = code;
}
- const TString& GetMessage() const noexcept
+ const std::string& GetMessage() const noexcept
{
return Message_;
}
- TString* MutableMessage() noexcept
+ std::string* MutableMessage() noexcept
{
return &Message_;
}
@@ -164,7 +164,7 @@ public:
private:
TErrorCode Code_;
- TString Message_;
+ std::string Message_;
TOriginAttributes OriginAttributes_{
.Pid = 0,
@@ -277,11 +277,11 @@ TError::TErrorOr(const std::exception& ex)
YT_VERIFY(!IsOK());
}
-TError::TErrorOr(TString message, TDisableFormat)
+TError::TErrorOr(std::string message, TDisableFormat)
: Impl_(std::make_unique<TImpl>(std::move(message)))
{ }
-TError::TErrorOr(TErrorCode code, TString message, TDisableFormat)
+TError::TErrorOr(TErrorCode code, std::string message, TDisableFormat)
: Impl_(std::make_unique<TImpl>(code, std::move(message)))
{ }
@@ -363,16 +363,16 @@ THashSet<TErrorCode> TError::GetDistinctNonTrivialErrorCodes() const
return result;
}
-const TString& TError::GetMessage() const
+const std::string& TError::GetMessage() const
{
if (!Impl_) {
- static const TString Result;
+ static const std::string Result;
return Result;
}
return Impl_->GetMessage();
}
-TError& TError::SetMessage(TString message)
+TError& TError::SetMessage(std::string message)
{
MakeMutable();
*Impl_->MutableMessage() = std::move(message);
@@ -422,7 +422,7 @@ NThreading::TThreadId TError::GetTid() const
TStringBuf TError::GetThreadName() const
{
if (!Impl_) {
- static TString empty;
+ static std::string empty;
return empty;
}
return Impl_->GetThreadName();
@@ -482,7 +482,7 @@ void TError::UpdateOriginAttributes()
Impl_->UpdateOriginAttributes();
}
-const TString InnerErrorsTruncatedKey("inner_errors_truncated");
+const std::string InnerErrorsTruncatedKey("inner_errors_truncated");
TError TError::Truncate(
int maxInnerErrorCount,
@@ -513,8 +513,7 @@ TError TError::Truncate(
auto result = std::make_unique<TImpl>();
result->SetCode(GetCode());
- *result->MutableMessage()
- = std::move(TruncateString(GetMessage(), stringLimit, ErrorMessageTruncatedSuffix));
+ *result->MutableMessage() = TruncateString(GetMessage(), stringLimit, ErrorMessageTruncatedSuffix);
if (Impl_->HasAttributes()) {
truncateAttributes(Impl_->Attributes(), result->MutableAttributes());
}
@@ -608,13 +607,13 @@ TError TError::Wrap() &&
return std::move(*this);
}
-Y_WEAK TString GetErrorSkeleton(const TError& /*error*/)
+Y_WEAK std::string GetErrorSkeleton(const TError& /*error*/)
{
// Proper implementation resides in yt/yt/library/error_skeleton/skeleton.cpp.
THROW_ERROR_EXCEPTION("Error skeleton implementation library is not linked; consider PEERDIR'ing yt/yt/library/error_skeleton");
}
-TString TError::GetSkeleton() const
+std::string TError::GetSkeleton() const
{
return GetErrorSkeleton(*this);
}
@@ -775,7 +774,7 @@ void AppendError(TStringBuilderBase* builder, const TError& error, int indent)
AppendAttribute(
builder,
"host",
- TString{originAttributes->Host},
+ std::string{originAttributes->Host},
indent);
}
diff --git a/library/cpp/yt/error/error.h b/library/cpp/yt/error/error.h
index beb097afe2..8b459d0beb 100644
--- a/library/cpp/yt/error/error.h
+++ b/library/cpp/yt/error/error.h
@@ -83,8 +83,8 @@ public:
{ };
static constexpr TDisableFormat DisableFormat = {};
- TErrorOr(TString message, TDisableFormat);
- TErrorOr(TErrorCode code, TString message, TDisableFormat);
+ TErrorOr(std::string message, TDisableFormat);
+ TErrorOr(TErrorCode code, std::string message, TDisableFormat);
template <class... TArgs>
explicit TErrorOr(
@@ -110,8 +110,8 @@ public:
TErrorCode GetNonTrivialCode() const;
THashSet<TErrorCode> GetDistinctNonTrivialErrorCodes() const;
- const TString& GetMessage() const;
- TError& SetMessage(TString message);
+ const std::string& GetMessage() const;
+ TError& SetMessage(std::string message);
bool HasOriginAttributes() const;
TProcessId GetPid() const;
@@ -197,7 +197,7 @@ public:
//! In order to prevent core -> re2 dependency, implementation belongs to a separate library
//! yt/yt/library/error_skeleton. Calling this method without PEERDIR'ing implementation
//! results in an exception.
- TString GetSkeleton() const;
+ std::string GetSkeleton() const;
TError& operator <<= (const TErrorAttribute& attribute) &;
TError& operator <<= (const std::vector<TErrorAttribute>& attributes) &;
@@ -281,7 +281,7 @@ public:
const char* what() const noexcept override;
private:
- mutable TString CachedWhat_;
+ mutable std::string CachedWhat_;
};
// Make these templates to avoid type erasure during throw.
diff --git a/library/cpp/yt/error/error_attributes-inl.h b/library/cpp/yt/error/error_attributes-inl.h
index 399c0792d4..310ededd02 100644
--- a/library/cpp/yt/error/error_attributes-inl.h
+++ b/library/cpp/yt/error/error_attributes-inl.h
@@ -55,8 +55,7 @@ template <class T>
requires CConvertibleFromAttributeValue<T>
T TErrorAttributes::GetAndRemove(const TKey& key, const T& defaultValue)
{
- auto value = Find<T>(key);
- if (value) {
+ if (auto value = Find<T>(key)) {
Remove(key);
return *value;
} else {
diff --git a/library/cpp/yt/error/error_attributes.h b/library/cpp/yt/error/error_attributes.h
index 8ab6388ef3..0ab0687dac 100644
--- a/library/cpp/yt/error/error_attributes.h
+++ b/library/cpp/yt/error/error_attributes.h
@@ -10,7 +10,7 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
// TODO(arkady-e1ppa): Try switching to TString/std::string eventually.
-// representing text-encoded yson string eventually (maybe).
+// representing text-encoded YSON string eventually (maybe).
class TErrorAttributes
{
public:
diff --git a/library/cpp/yt/error/error_code.cpp b/library/cpp/yt/error/error_code.cpp
index 9cb0d57dc2..d82d03214d 100644
--- a/library/cpp/yt/error/error_code.cpp
+++ b/library/cpp/yt/error/error_code.cpp
@@ -85,7 +85,7 @@ bool TErrorCodeRegistry::TErrorCodeRangeInfo::Contains(int value) const
return From <= value && value <= To;
}
-void TErrorCodeRegistry::RegisterErrorCodeRange(int from, int to, TString namespaceName, std::function<TString(int)> formatter)
+void TErrorCodeRegistry::RegisterErrorCodeRange(int from, int to, std::string namespaceName, std::function<std::string(int)> formatter)
{
YT_VERIFY(from <= to);
@@ -117,24 +117,26 @@ void TErrorCodeRegistry::CheckCodesAgainstRanges() const
}
}
-TString TErrorCodeRegistry::ParseNamespace(const std::type_info& errorCodeEnumTypeInfo)
+std::string TErrorCodeRegistry::ParseNamespace(const std::type_info& errorCodeEnumTypeInfo)
{
- TString name;
+ std::string name;
// Ensures that "EErrorCode" is found as a substring in the type name and stores the prefix before
// the first occurrence into #name.
YT_VERIFY(StringSplitter(
TypeName(errorCodeEnumTypeInfo)).SplitByString("EErrorCode").Limit(2).TryCollectInto(&name, &std::ignore));
// TypeName returns name in form "enum ErrorCode" on Windows
- if (name.StartsWith("enum ")) {
- name.remove(0, 5);
+ constexpr TStringBuf enumPrefix = "enum ";
+ if (name.starts_with(enumPrefix)) {
+ name.erase(0, enumPrefix.size());
}
// If the enum was declared directly in the global namespace, #name should be empty.
// Otherwise, #name should end with "::".
+ constexpr TStringBuf namespaceSeparator = "::";
if (!name.empty()) {
- YT_VERIFY(name.EndsWith("::"));
- name.resize(name.size() - 2);
+ YT_VERIFY(name.ends_with(namespaceSeparator));
+ name.resize(name.size() - namespaceSeparator.size());
}
return name;
}
diff --git a/library/cpp/yt/error/error_code.h b/library/cpp/yt/error/error_code.h
index 1c2c08fbb4..fe1a25c3c3 100644
--- a/library/cpp/yt/error/error_code.h
+++ b/library/cpp/yt/error/error_code.h
@@ -19,9 +19,9 @@ public:
struct TErrorCodeInfo
{
- TString Namespace;
+ std::string Namespace;
//! Human-readable error code name.
- TString Name;
+ std::string Name;
bool operator==(const TErrorCodeInfo& rhs) const;
};
@@ -30,8 +30,8 @@ public:
{
int From;
int To;
- TString Namespace;
- std::function<TString(int code)> Formatter;
+ std::string Namespace;
+ std::function<std::string(int code)> Formatter;
TErrorCodeInfo Get(int code) const;
bool Intersects(const TErrorCodeRangeInfo& other) const;
@@ -51,9 +51,9 @@ public:
void RegisterErrorCode(int code, const TErrorCodeInfo& errorCodeInfo);
//! Registers a range of error codes given a human-readable code to name formatter.
- void RegisterErrorCodeRange(int from, int to, TString namespaceName, std::function<TString(int code)> formatter);
+ void RegisterErrorCodeRange(int from, int to, std::string namespaceName, std::function<std::string(int code)> formatter);
- static TString ParseNamespace(const std::type_info& errorCodeEnumTypeInfo);
+ static std::string ParseNamespace(const std::type_info& errorCodeEnumTypeInfo);
private:
THashMap<int, TErrorCodeInfo> CodeToInfo_;
diff --git a/library/cpp/yt/error/origin_attributes.cpp b/library/cpp/yt/error/origin_attributes.cpp
index 2abb060ce2..69569762c4 100644
--- a/library/cpp/yt/error/origin_attributes.cpp
+++ b/library/cpp/yt/error/origin_attributes.cpp
@@ -84,7 +84,7 @@ std::optional<TOriginAttributes::TErasedExtensionData> GetExtensionData()
return std::nullopt;
}
-TString FormatOrigin(const TOriginAttributes& attributes)
+std::string FormatOrigin(const TOriginAttributes& attributes)
{
using TFunctor = TString(*)(const TOriginAttributes&);
@@ -142,7 +142,7 @@ TOriginAttributes ExtractFromDictionaryDefault(TErrorAttributes* attributes)
result.Tid = attributes->GetAndRemove(TidKey, NThreading::InvalidThreadId);
static const std::string ThreadNameKey("thread");
- result.ThreadName = TString(attributes->GetAndRemove(ThreadNameKey, std::string()));
+ result.ThreadName = {attributes->GetAndRemove(ThreadNameKey, std::string())};
return result;
}
diff --git a/library/cpp/yt/error/origin_attributes.h b/library/cpp/yt/error/origin_attributes.h
index e25eb37ea7..7d35446318 100644
--- a/library/cpp/yt/error/origin_attributes.h
+++ b/library/cpp/yt/error/origin_attributes.h
@@ -76,7 +76,7 @@ inline constexpr NGlobal::TVariableTag ExtractFromDictionaryTag = {};
// NB(arkady-e1ppa): ExtractFromDictionary symbol is left in yt/yt/core/misc/origin_attributes
// because it depends on ytree for now.
std::optional<TOriginAttributes::TErasedExtensionData> GetExtensionData();
-TString FormatOrigin(const TOriginAttributes& attributes);
+std::string FormatOrigin(const TOriginAttributes& attributes);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/error/text_yson.cpp b/library/cpp/yt/error/text_yson.cpp
index 42ad52bbcc..698c2fd244 100644
--- a/library/cpp/yt/error/text_yson.cpp
+++ b/library/cpp/yt/error/text_yson.cpp
@@ -137,7 +137,7 @@ std::string ConvertToTextYsonString<double>(const double& value)
"%v%v",
str,
MakeFormatterWrapper([&] (TStringBuilderBase* builder) {
- if (str.find('.') == TString::npos && str.find('e') == TString::npos && std::isfinite(value)) {
+ if (str.find('.') == std::string::npos && str.find('e') == std::string::npos && std::isfinite(value)) {
builder->AppendChar('.');
}
}));
@@ -233,13 +233,13 @@ TSomeInt ParseSomeIntFromTextYsonString(TStringBuf strBuf)
////////////////////////////////////////////////////////////////////////////////
-TString DoParseStringFromTextYson(TStringBuf strBuf)
+std::string DoParseStringFromTextYson(TStringBuf strBuf)
{
// Remove quotation marks.
return ::UnescapeC(TStringBuf{strBuf.data() + 1, strBuf.length() - 2});
}
-TString ParseStringFromTextYsonString(TStringBuf strBuf)
+std::string ParseStringFromTextYsonString(TStringBuf strBuf)
{
if (std::ssize(strBuf) < 2 || strBuf.front() != '\"' || strBuf.back() != '\"') {
THROW_ERROR_EXCEPTION(
@@ -314,7 +314,7 @@ PARSE_INT(ui64, ui64)
////////////////////////////////////////////////////////////////////////////////
template <>
-TString ConvertFromTextYsonString<TString>(TStringBuf str)
+std::string ConvertFromTextYsonString<std::string>(TStringBuf str)
{
try {
return ParseStringFromTextYsonString(str);
@@ -324,9 +324,9 @@ TString ConvertFromTextYsonString<TString>(TStringBuf str)
}
template <>
-std::string ConvertFromTextYsonString<std::string>(TStringBuf str)
+TString ConvertFromTextYsonString<TString>(TStringBuf str)
{
- return std::string(ConvertFromTextYsonString<TString>(str));
+ return TString(ConvertFromTextYsonString<std::string>(str));
}
template <>
diff --git a/library/cpp/yt/error/unittests/error_code_ut.cpp b/library/cpp/yt/error/unittests/error_code_ut.cpp
index 4bdb17f5d9..833982ea02 100644
--- a/library/cpp/yt/error/unittests/error_code_ut.cpp
+++ b/library/cpp/yt/error/unittests/error_code_ut.cpp
@@ -61,7 +61,7 @@ YT_DEFINE_ERROR_ENUM(
((Kukarek) (-2007))
);
-TString TestErrorCodeFormatter(int code)
+std::string TestErrorCodeFormatter(int code)
{
return Format("formatted%v", code);
}
@@ -74,7 +74,7 @@ DEFINE_ENUM(EDifferentTestErrorCode,
((ErrorNumberThree) (-10002))
);
-TString DifferentTestErrorCodeFormatter(int code)
+std::string DifferentTestErrorCodeFormatter(int code)
{
return TEnumTraits<EDifferentTestErrorCode>::ToString(static_cast<EDifferentTestErrorCode>(code));
}
diff --git a/library/cpp/yt/error/unittests/error_ut.cpp b/library/cpp/yt/error/unittests/error_ut.cpp
index a4248b3956..198aa1ecd8 100644
--- a/library/cpp/yt/error/unittests/error_ut.cpp
+++ b/library/cpp/yt/error/unittests/error_ut.cpp
@@ -202,7 +202,7 @@ void IterateTestOverEveryRightOperand(TOverloadTest& tester)
}
template <class T>
-void SetErrorAttribute(TError* error, TString key, const T& value)
+void SetErrorAttribute(TError* error, const std::string& key, const T& value)
{
*error <<= TErrorAttribute(key, value);
}
@@ -357,7 +357,7 @@ TEST(TErrorTest, ThrowErrorExceptionIfFailedMacroExpression)
EXPECT_EQ(outerError.GetMessage(), "Outer error");
EXPECT_EQ(outerError.InnerErrors().size(), 1u);
EXPECT_EQ(outerError.InnerErrors()[0].GetMessage(), "Inner error");
- EXPECT_EQ(outerError.InnerErrors()[0].Attributes().Get<TString>("attr"), "attr_value");
+ EXPECT_EQ(outerError.InnerErrors()[0].Attributes().Get<std::string>("attr"), "attr_value");
}
}
@@ -427,7 +427,7 @@ TEST(TErrorTest, TruncateSimple)
EXPECT_EQ(error.GetPid(), truncatedError.GetPid());
EXPECT_EQ(error.GetTid(), truncatedError.GetTid());
EXPECT_EQ(error.GetDatetime(), truncatedError.GetDatetime());
- EXPECT_EQ(error.Attributes().Get<TString>("my_attr"), truncatedError.Attributes().Get<TString>("my_attr"));
+ EXPECT_EQ(error.Attributes().Get<std::string>("my_attr"), truncatedError.Attributes().Get<std::string>("my_attr"));
EXPECT_EQ(error.InnerErrors().size(), truncatedError.InnerErrors().size());
EXPECT_EQ(error.InnerErrors()[0].GetMessage(), truncatedError.InnerErrors()[0].GetMessage());
}
@@ -444,7 +444,7 @@ TEST(TErrorTest, TruncateLarge)
auto truncatedError = error.Truncate(/*maxInnerErrorCount*/ 3, /*stringLimit*/ 10);
EXPECT_EQ(error.GetCode(), truncatedError.GetCode());
EXPECT_EQ("Some long ...<message truncated>", truncatedError.GetMessage());
- EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("my_attr"));
+ EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("my_attr"));
EXPECT_EQ(truncatedError.InnerErrors().size(), 3u);
EXPECT_EQ("First inne...<message truncated>", truncatedError.InnerErrors()[0].GetMessage());
@@ -466,7 +466,7 @@ TEST(TErrorTest, TruncateSimpleRValue)
EXPECT_EQ(error.GetPid(), truncatedError.GetPid());
EXPECT_EQ(error.GetTid(), truncatedError.GetTid());
EXPECT_EQ(error.GetDatetime(), truncatedError.GetDatetime());
- EXPECT_EQ(error.Attributes().Get<TString>("my_attr"), truncatedError.Attributes().Get<TString>("my_attr"));
+ EXPECT_EQ(error.Attributes().Get<std::string>("my_attr"), truncatedError.Attributes().Get<std::string>("my_attr"));
EXPECT_EQ(error.InnerErrors().size(), truncatedError.InnerErrors().size());
EXPECT_EQ(error.InnerErrors()[0].GetMessage(), truncatedError.InnerErrors()[0].GetMessage());
}
@@ -486,7 +486,7 @@ TEST(TErrorTest, TruncateLargeRValue)
EXPECT_EQ(error.GetCode(), truncatedError.GetCode());
EXPECT_EQ("Some long ...<message truncated>", truncatedError.GetMessage());
- EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("my_attr"));
+ EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("my_attr"));
EXPECT_EQ(truncatedError.InnerErrors().size(), 3u);
EXPECT_EQ("First inne...<message truncated>", truncatedError.InnerErrors()[0].GetMessage());
@@ -524,8 +524,8 @@ TEST(TErrorTest, TruncateWhitelist)
EXPECT_EQ(error.GetCode(), truncatedError.GetCode());
EXPECT_EQ(error.GetMessage(), truncatedError.GetMessage());
- EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("attr1"));
- EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<TString>("attr2"));
+ EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("attr1"));
+ EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<std::string>("attr2"));
}
TEST(TErrorTest, TruncateWhitelistRValue)
@@ -543,8 +543,8 @@ TEST(TErrorTest, TruncateWhitelistRValue)
EXPECT_EQ(error.GetCode(), truncatedError.GetCode());
EXPECT_EQ(error.GetMessage(), truncatedError.GetMessage());
- EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("attr1"));
- EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<TString>("attr2"));
+ EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("attr1"));
+ EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<std::string>("attr2"));
}
TEST(TErrorTest, TruncateWhitelistInnerErrors)
@@ -563,8 +563,8 @@ TEST(TErrorTest, TruncateWhitelistInnerErrors)
auto truncatedInnerError = truncatedError.InnerErrors()[0];
EXPECT_EQ(truncatedInnerError.GetCode(), innerError.GetCode());
EXPECT_EQ(truncatedInnerError.GetMessage(), innerError.GetMessage());
- EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<TString>("attr1"));
- EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<TString>("attr2"));
+ EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<std::string>("attr1"));
+ EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<std::string>("attr2"));
}
TEST(TErrorTest, TruncateWhitelistInnerErrorsRValue)
@@ -585,8 +585,8 @@ TEST(TErrorTest, TruncateWhitelistInnerErrorsRValue)
auto truncatedInnerError = truncatedError.InnerErrors()[0];
EXPECT_EQ(truncatedInnerError.GetCode(), innerError.GetCode());
EXPECT_EQ(truncatedInnerError.GetMessage(), innerError.GetMessage());
- EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<TString>("attr1"));
- EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<TString>("attr2"));
+ EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<std::string>("attr1"));
+ EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<std::string>("attr2"));
}
TEST(TErrorTest, TruncateWhitelistSaveInnerError)
@@ -668,7 +668,7 @@ TEST(TErrorTest, YTExceptionWithAttributesToError)
EXPECT_TRUE(boolValue);
EXPECT_EQ(*boolValue, false);
- auto stringValue = error.Attributes().Find<TString>("String value");
+ auto stringValue = error.Attributes().Find<std::string>("String value");
EXPECT_TRUE(stringValue);
EXPECT_EQ(*stringValue, "FooBar");
}
@@ -677,19 +677,19 @@ TEST(TErrorTest, YTExceptionWithAttributesToError)
TEST(TErrorTest, AttributeSerialization)
{
auto getWeededText = [] (const TError& err) {
- std::vector<TString> lines;
+ std::vector<std::string> lines;
for (const auto& line : StringSplitter(ToString(err)).Split('\n')) {
if (!line.Contains("origin") && !line.Contains("datetime")) {
- lines.push_back(TString{line});
+ lines.push_back(std::string{line});
}
}
return JoinSeq("\n", lines);
};
- EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "V1")), TString(
+ EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "V1")), std::string(
"E1\n"
" A1 V1\n"));
- EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "L1\nL2\nL3")), TString(
+ EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "L1\nL2\nL3")), std::string(
"E1\n"
" A1\n"
" L1\n"
diff --git a/library/cpp/yt/exception/exception.cpp b/library/cpp/yt/exception/exception.cpp
index 71ece1ff2e..5a1e33d7a6 100644
--- a/library/cpp/yt/exception/exception.cpp
+++ b/library/cpp/yt/exception/exception.cpp
@@ -20,14 +20,14 @@ void AddAttributes(TSimpleException::TAttributes& attrs, TRange&& range)
////////////////////////////////////////////////////////////////////////////////
-TSimpleException::TSimpleException(TString message)
+TSimpleException::TSimpleException(std::string message)
: Message_(std::move(message))
, What_(Message_)
{ }
TSimpleException::TSimpleException(
const std::exception& exception,
- TString message)
+ std::string message)
: InnerException_(std::current_exception())
, Message_(std::move(message))
, What_(Message_ + "\n" + exception.what())
@@ -43,7 +43,7 @@ const char* TSimpleException::what() const noexcept
return What_.c_str();
}
-const TString& TSimpleException::GetMessage() const
+const std::string& TSimpleException::GetMessage() const
{
return Message_;
}
diff --git a/library/cpp/yt/exception/exception.h b/library/cpp/yt/exception/exception.h
index 2898b99f0d..6e939d072a 100644
--- a/library/cpp/yt/exception/exception.h
+++ b/library/cpp/yt/exception/exception.h
@@ -25,15 +25,15 @@ public:
{ ex <<= std::forward<TValue>(operand) } -> std::same_as<TSimpleException&>;
};
- explicit TSimpleException(TString message);
+ explicit TSimpleException(std::string message);
TSimpleException(
const std::exception& exception,
- TString message);
+ std::string message);
const std::exception_ptr& GetInnerException() const;
const char* what() const noexcept override;
- const TString& GetMessage() const;
+ const std::string& GetMessage() const;
const TAttributes& GetAttributes() const &;
TAttributes&& GetAttributes() &&;
@@ -65,8 +65,8 @@ public:
private:
const std::exception_ptr InnerException_;
- const TString Message_;
- const TString What_;
+ const std::string Message_;
+ const std::string What_;
TAttributes Attributes_;
};
diff --git a/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp b/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp
index 8b46d5679f..c23c5693b0 100644
--- a/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp
+++ b/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp
@@ -66,7 +66,7 @@ private:
IOutputStream* const Output_;
NThreading::TForkAwareSpinLock SpinLock_;
- THashMap<TString, std::unique_ptr<TLoggingCategory>> NameToCategory_;
+ THashMap<std::string, std::unique_ptr<TLoggingCategory>, THash<TStringBuf>, TEqualTo<TStringBuf>> NameToCategory_;
std::atomic<int> Version_ = 1;
TPlainTextEventFormatter EventFormatter_{/*enableSourceLocation*/ false};
diff --git a/library/cpp/yt/logging/logger.h b/library/cpp/yt/logging/logger.h
index 510acf1310..53bb13e705 100644
--- a/library/cpp/yt/logging/logger.h
+++ b/library/cpp/yt/logging/logger.h
@@ -30,7 +30,7 @@ constexpr double DefaultStructuredValidationSamplingRate = 0.01;
struct TLoggingCategory
{
- TString Name;
+ std::string Name;
//! This value is used for early dropping of plaintext events in order
//! to reduce load on logging thread for events which are definitely going
//! to be dropped due to rule setup.
@@ -50,7 +50,7 @@ struct TLoggingAnchor
TLoggingAnchor* NextAnchor = nullptr;
::TSourceLocation SourceLocation = {TStringBuf{}, 0};
- TString AnchorMessage;
+ std::string AnchorMessage;
std::atomic<int> CurrentVersion = 0;
diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp
index fc4f146532..0dcb9a1f7e 100644
--- a/library/cpp/yt/misc/guid.cpp
+++ b/library/cpp/yt/misc/guid.cpp
@@ -49,7 +49,7 @@ TGuid TGuid::FromString(TStringBuf str)
TGuid guid;
if (!FromString(str, &guid)) {
throw TSimpleException(Sprintf("Error parsing GUID \"%s\"",
- TString(str).c_str()));
+ std::string(str).c_str()));
}
return guid;
}
@@ -106,7 +106,7 @@ TGuid TGuid::FromStringHex32(TStringBuf str)
TGuid guid;
if (!FromStringHex32(str, &guid)) {
throw TSimpleException(Sprintf("Error parsing Hex32 GUID \"%s\"",
- TString(str).c_str()));
+ str.data()));
}
return guid;
}
diff --git a/library/cpp/yt/misc/thread_name.cpp b/library/cpp/yt/misc/thread_name.cpp
index bb1737b08a..11e20abcf5 100644
--- a/library/cpp/yt/misc/thread_name.cpp
+++ b/library/cpp/yt/misc/thread_name.cpp
@@ -20,7 +20,7 @@ TStringBuf TThreadName::ToStringBuf() const
////////////////////////////////////////////////////////////////////////////////
-TThreadName::TThreadName(const TString& name)
+TThreadName::TThreadName(TStringBuf name)
{
Length = std::min<int>(TThreadName::BufferCapacity - 1, name.length());
::memcpy(Buffer.data(), name.data(), Length);
diff --git a/library/cpp/yt/misc/thread_name.h b/library/cpp/yt/misc/thread_name.h
index 233808f99f..3515388083 100644
--- a/library/cpp/yt/misc/thread_name.h
+++ b/library/cpp/yt/misc/thread_name.h
@@ -11,7 +11,7 @@ namespace NYT {
struct TThreadName
{
TThreadName() = default;
- TThreadName(const TString& name);
+ TThreadName(TStringBuf name);
TStringBuf ToStringBuf() const;
diff --git a/library/cpp/yt/string/enum-inl.h b/library/cpp/yt/string/enum-inl.h
index 84b0941d15..9f8ca893d2 100644
--- a/library/cpp/yt/string/enum-inl.h
+++ b/library/cpp/yt/string/enum-inl.h
@@ -129,7 +129,7 @@ void FormatEnum(TStringBuilderBase* builder, T value, bool lowerCase)
}
template <class T>
-TString FormatEnum(T value)
+std::string FormatEnum(T value)
{
TStringBuilder builder;
FormatEnum(&builder, value, /*lowerCase*/ true);
diff --git a/library/cpp/yt/string/enum.cpp b/library/cpp/yt/string/enum.cpp
index 935c3e6e3e..844254faa0 100644
--- a/library/cpp/yt/string/enum.cpp
+++ b/library/cpp/yt/string/enum.cpp
@@ -16,7 +16,7 @@ void ThrowMalformedEnumValueException(TStringBuf typeName, TStringBuf value)
}
template <bool ThrowOnError>
-std::optional<TString> DecodeEnumValueImpl(TStringBuf value)
+std::optional<std::string> DecodeEnumValueImpl(TStringBuf value)
{
auto camelValue = UnderscoreCaseToCamelCase(value);
auto underscoreValue = CamelCaseToUnderscoreCase(camelValue);
@@ -34,19 +34,19 @@ std::optional<TString> DecodeEnumValueImpl(TStringBuf value)
} // namespace NDetail
-std::optional<TString> TryDecodeEnumValue(TStringBuf value)
+std::optional<std::string> TryDecodeEnumValue(TStringBuf value)
{
return NDetail::DecodeEnumValueImpl<false>(value);
}
-TString DecodeEnumValue(TStringBuf value)
+std::string DecodeEnumValue(TStringBuf value)
{
auto decodedValue = NDetail::DecodeEnumValueImpl<true>(value);
YT_VERIFY(decodedValue);
return *decodedValue;
}
-TString EncodeEnumValue(TStringBuf value)
+std::string EncodeEnumValue(TStringBuf value)
{
return CamelCaseToUnderscoreCase(value);
}
diff --git a/library/cpp/yt/string/enum.h b/library/cpp/yt/string/enum.h
index a0be527583..de7d6a52fa 100644
--- a/library/cpp/yt/string/enum.h
+++ b/library/cpp/yt/string/enum.h
@@ -10,9 +10,9 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
-std::optional<TString> TryDecodeEnumValue(TStringBuf value);
-TString DecodeEnumValue(TStringBuf value);
-TString EncodeEnumValue(TStringBuf value);
+std::optional<std::string> TryDecodeEnumValue(TStringBuf value);
+std::string DecodeEnumValue(TStringBuf value);
+std::string EncodeEnumValue(TStringBuf value);
template <class T>
std::optional<T> TryParseEnum(TStringBuf str, bool enableUnknown = false);
@@ -24,7 +24,7 @@ template <class T>
void FormatEnum(TStringBuilderBase* builder, T value, bool lowerCase);
template <class T>
-TString FormatEnum(T value);
+std::string FormatEnum(T value);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp
index b9c3236134..ed51f453fb 100644
--- a/library/cpp/yt/string/string.cpp
+++ b/library/cpp/yt/string/string.cpp
@@ -359,7 +359,7 @@ TStringBuf FormatBool(bool value)
////////////////////////////////////////////////////////////////////////////////
-void TruncateStringInplace(TString* string, int lengthLimit, TStringBuf truncatedSuffix)
+void TruncateStringInplace(std::string* string, int lengthLimit, TStringBuf truncatedSuffix)
{
if (std::ssize(*string) > lengthLimit) {
string->resize(lengthLimit);
@@ -367,7 +367,7 @@ void TruncateStringInplace(TString* string, int lengthLimit, TStringBuf truncate
}
}
-TString TruncateString(TString string, int lengthLimit, TStringBuf truncatedSuffix)
+std::string TruncateString(std::string string, int lengthLimit, TStringBuf truncatedSuffix)
{
TruncateStringInplace(&string, lengthLimit, truncatedSuffix);
return string;
diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h
index ac5aa5d4e4..5e472a572c 100644
--- a/library/cpp/yt/string/string.h
+++ b/library/cpp/yt/string/string.h
@@ -183,9 +183,8 @@ TStringBuf FormatBool(bool value);
inline constexpr TStringBuf DefaultTruncatedMessage = "...<truncated>";
-void TruncateStringInplace(TString* string, int lengthLimit, TStringBuf truncatedSuffix = DefaultTruncatedMessage);
-
-TString TruncateString(TString string, int lengthLimit, TStringBuf truncatedSuffix = DefaultTruncatedMessage);
+void TruncateStringInplace(std::string* string, int lengthLimit, TStringBuf truncatedSuffix = DefaultTruncatedMessage);
+std::string TruncateString(std::string string, int lengthLimit, TStringBuf truncatedSuffix = DefaultTruncatedMessage);
////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/yt/string/unittests/guid_ut.cpp b/library/cpp/yt/string/unittests/guid_ut.cpp
index ed02b87391..9cff37c380 100644
--- a/library/cpp/yt/string/unittests/guid_ut.cpp
+++ b/library/cpp/yt/string/unittests/guid_ut.cpp
@@ -12,7 +12,7 @@ namespace {
static_assert(CFormattable<TGuid>);
-TString CanonicalToString(TGuid value)
+std::string CanonicalToString(TGuid value)
{
return Sprintf("%x-%x-%x-%x",
value.Parts32[3],
@@ -48,7 +48,7 @@ TEST(TGuidTest, FormatAllSymbols)
TEST(TGuidTest, ByteOrder)
{
auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01");
- TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16};
+ std::string bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16};
EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412");
}
diff --git a/yt/yql/providers/yt/comp_nodes/dq/dq_yt_block_reader.cpp b/yt/yql/providers/yt/comp_nodes/dq/dq_yt_block_reader.cpp
index 46273d69c1..df4a15fe46 100644
--- a/yt/yql/providers/yt/comp_nodes/dq/dq_yt_block_reader.cpp
+++ b/yt/yql/providers/yt/comp_nodes/dq/dq_yt_block_reader.cpp
@@ -428,7 +428,7 @@ public:
if (!res.IsOK()) {
// Propagate error
- Listener_->HandleError(res.GetMessage());
+ Listener_->HandleError(TString(res.GetMessage()));
return;
}
diff --git a/yt/yt/client/api/operation_client.h b/yt/yt/client/api/operation_client.h
index df0f3411e1..9a2ccfc976 100644
--- a/yt/yt/client/api/operation_client.h
+++ b/yt/yt/client/api/operation_client.h
@@ -114,11 +114,11 @@ struct TGetJobFailContextOptions
struct TListOperationsAccessFilter
: public NYTree::TYsonStruct
{
- TString Subject;
+ std::string Subject;
NYTree::EPermissionSet Permissions;
// This parameter cannot be set from YSON, it must be computed.
- THashSet<TString> SubjectTransitiveClosure;
+ THashSet<std::string> SubjectTransitiveClosure;
REGISTER_YSON_STRUCT(TListOperationsAccessFilter);
@@ -303,7 +303,7 @@ struct TOperation
std::optional<TInstant> StartTime;
std::optional<TInstant> FinishTime;
- std::optional<TString> AuthenticatedUser;
+ std::optional<std::string> AuthenticatedUser;
NYson::TYsonString BriefSpec;
NYson::TYsonString Spec;
@@ -319,7 +319,7 @@ struct TOperation
NYson::TYsonString RuntimeParameters;
std::optional<bool> Suspended;
- std::optional<TString> SuspendReason;
+ std::optional<std::string> SuspendReason;
NYson::TYsonString Events;
NYson::TYsonString Result;
diff --git a/yt/yt/client/object_client/helpers.cpp b/yt/yt/client/object_client/helpers.cpp
index 6dbea8270c..0fbc5a8c9b 100644
--- a/yt/yt/client/object_client/helpers.cpp
+++ b/yt/yt/client/object_client/helpers.cpp
@@ -332,9 +332,11 @@ bool IsSchemaType(EObjectType type)
return (static_cast<ui32>(type) & SchemaObjectTypeMask) != 0;
}
-TString FormatObjectType(EObjectType type)
+std::string FormatObjectType(EObjectType type)
{
- return IsSchemaType(type) ? Format("schema:%v", TypeFromSchemaType(type)) : FormatEnum(type);
+ return IsSchemaType(type)
+ ? std::string(Format("schema:%v", TypeFromSchemaType(type)))
+ : FormatEnum(type);
}
bool IsGlobalCellId(TCellId cellId)
diff --git a/yt/yt/client/object_client/helpers.h b/yt/yt/client/object_client/helpers.h
index 8ff3066b25..6a4f49c30c 100644
--- a/yt/yt/client/object_client/helpers.h
+++ b/yt/yt/client/object_client/helpers.h
@@ -125,7 +125,7 @@ EObjectType SchemaTypeFromType(EObjectType type);
EObjectType TypeFromSchemaType(EObjectType type);
//! Formats object type into string (taking schemas into account).
-TString FormatObjectType(EObjectType type);
+std::string FormatObjectType(EObjectType type);
//! Constructs the id from its parts.
TObjectId MakeId(
diff --git a/yt/yt/client/security_client/acl.cpp b/yt/yt/client/security_client/acl.cpp
index 25f4db0c33..efe43529ed 100644
--- a/yt/yt/client/security_client/acl.cpp
+++ b/yt/yt/client/security_client/acl.cpp
@@ -16,7 +16,7 @@ TSerializableAccessControlEntry::TSerializableAccessControlEntry() = default;
TSerializableAccessControlEntry::TSerializableAccessControlEntry(
ESecurityAction action,
- std::vector<TString> subjects,
+ std::vector<std::string> subjects,
EPermissionSet permissions,
EAceInheritanceMode inheritanceMode)
: Action(action)
diff --git a/yt/yt/client/security_client/acl.h b/yt/yt/client/security_client/acl.h
index 28f2edd762..24ade027b8 100644
--- a/yt/yt/client/security_client/acl.h
+++ b/yt/yt/client/security_client/acl.h
@@ -17,16 +17,16 @@ namespace NYT::NSecurityClient {
struct TSerializableAccessControlEntry
{
ESecurityAction Action = ESecurityAction::Undefined;
- std::vector<TString> Subjects;
+ std::vector<std::string> Subjects;
NYTree::EPermissionSet Permissions;
EAceInheritanceMode InheritanceMode = EAceInheritanceMode::ObjectAndDescendants;
- TString SubjectTagFilter;
+ std::optional<std::string> SubjectTagFilter;
std::optional<std::vector<std::string>> Columns;
std::optional<bool> Vital;
TSerializableAccessControlEntry(
ESecurityAction action,
- std::vector<TString> subjects,
+ std::vector<std::string> subjects,
NYTree::EPermissionSet permissions,
EAceInheritanceMode inheritanceMode = EAceInheritanceMode::ObjectAndDescendants);
diff --git a/yt/yt/client/security_client/helpers.cpp b/yt/yt/client/security_client/helpers.cpp
index 88df829c05..c08fb9c9be 100644
--- a/yt/yt/client/security_client/helpers.cpp
+++ b/yt/yt/client/security_client/helpers.cpp
@@ -15,12 +15,12 @@ TYPath GetUserPath(const std::string& name)
return "//sys/users/" + ToYPathLiteral(name);
}
-TYPath GetGroupPath(const TString& name)
+TYPath GetGroupPath(const std::string& name)
{
return "//sys/groups/" + ToYPathLiteral(name);
}
-TYPath GetAccountPath(const TString& name)
+TYPath GetAccountPath(const std::string& name)
{
return "//sys/accounts/" + ToYPathLiteral(name);
}
@@ -29,7 +29,7 @@ TYPath GetAccountPath(const TString& name)
ESecurityAction CheckPermissionsByAclAndSubjectClosure(
const TSerializableAccessControlList& acl,
- const THashSet<TString>& subjectClosure,
+ const THashSet<std::string>& subjectClosure,
NYTree::EPermissionSet permissions)
{
NYTree::EPermissionSet allowedPermissions = {};
@@ -37,7 +37,7 @@ ESecurityAction CheckPermissionsByAclAndSubjectClosure(
for (const auto& ace : acl.Entries) {
if (ace.Action != NSecurityClient::ESecurityAction::Allow && ace.Action != NSecurityClient::ESecurityAction::Deny) {
- THROW_ERROR_EXCEPTION("Action %Qv is not supported", FormatEnum(ace.Action));
+ THROW_ERROR_EXCEPTION("Action %Qlv is not supported", ace.Action);
}
for (const auto& aceSubject : ace.Subjects) {
if (subjectClosure.contains(aceSubject)) {
diff --git a/yt/yt/client/security_client/helpers.h b/yt/yt/client/security_client/helpers.h
index 650b1341d9..6c72590cac 100644
--- a/yt/yt/client/security_client/helpers.h
+++ b/yt/yt/client/security_client/helpers.h
@@ -12,14 +12,14 @@ namespace NYT::NSecurityClient {
////////////////////////////////////////////////////////////////////////////////
NYPath::TYPath GetUserPath(const std::string& name);
-NYPath::TYPath GetGroupPath(const TString& name);
-NYPath::TYPath GetAccountPath(const TString& name);
+NYPath::TYPath GetGroupPath(const std::string& name);
+NYPath::TYPath GetAccountPath(const std::string& name);
////////////////////////////////////////////////////////////////////////////////
ESecurityAction CheckPermissionsByAclAndSubjectClosure(
const TSerializableAccessControlList& acl,
- const THashSet<TString>& subjectClosure,
+ const THashSet<std::string>& subjectClosure,
NYTree::EPermissionSet permissions);
void ValidateSecurityTag(const TSecurityTag& tag);
diff --git a/yt/yt/client/ypath/rich.cpp b/yt/yt/client/ypath/rich.cpp
index 6a4bd12a2a..60e853ac2c 100644
--- a/yt/yt/client/ypath/rich.cpp
+++ b/yt/yt/client/ypath/rich.cpp
@@ -662,8 +662,7 @@ std::optional<std::string> TRichYPath::GetCluster() const
void TRichYPath::SetCluster(const std::string& value)
{
- // TODO(babenko): switch to std::string
- Attributes().Set("cluster", TString(value));
+ Attributes().Set("cluster", value);
}
std::optional<std::vector<TString>> TRichYPath::GetClusters() const
diff --git a/yt/yt/core/logging/config.h b/yt/yt/core/logging/config.h
index 60f02ad45d..f634e3af4f 100644
--- a/yt/yt/core/logging/config.h
+++ b/yt/yt/core/logging/config.h
@@ -166,9 +166,9 @@ public:
THashMap<TString, i64> CategoryRateLimits;
//! Messages with these prefixes will not be logged regardless of the configured levels.
- std::vector<TString> SuppressedMessages;
+ std::vector<std::string> SuppressedMessages;
//! Overrides levels of messages with a matching prefix .
- THashMap<TString, ELogLevel> MessageLevelOverrides;
+ THashMap<std::string, ELogLevel> MessageLevelOverrides;
TDuration RequestSuppressionTimeout;
@@ -224,8 +224,8 @@ public:
std::optional<std::vector<TRuleConfigPtr>> Rules;
std::optional<THashMap<TString, i64>> CategoryRateLimits;
- std::optional<std::vector<TString>> SuppressedMessages;
- THashMap<TString, ELogLevel> MessageLevelOverrides;
+ std::optional<std::vector<std::string>> SuppressedMessages;
+ THashMap<std::string, ELogLevel> MessageLevelOverrides;
std::optional<TDuration> RequestSuppressionTimeout;
diff --git a/yt/yt/core/logging/log_manager.cpp b/yt/yt/core/logging/log_manager.cpp
index dce60bf222..d257351f25 100644
--- a/yt/yt/core/logging/log_manager.cpp
+++ b/yt/yt/core/logging/log_manager.cpp
@@ -1377,18 +1377,18 @@ private:
{
YT_ASSERT_SPINLOCK_AFFINITY(SpinLock_);
- auto isPrefixOf = [] (const TString& message, const std::vector<TString>& prefixes) {
+ auto isPrefixOf = [] (const std::string& message, const std::vector<std::string>& prefixes) {
for (const auto& prefix : prefixes) {
- if (message.StartsWith(prefix)) {
+ if (message.starts_with(prefix)) {
return true;
}
}
return false;
};
- auto findByPrefix = [] (const TString& message, const THashMap<TString, ELogLevel>& levelOverrides) -> std::optional<ELogLevel> {
+ auto findByPrefix = [] (const std::string& message, const THashMap<std::string, ELogLevel>& levelOverrides) -> std::optional<ELogLevel> {
for (const auto& [prefix, level] : levelOverrides) {
- if (message.StartsWith(prefix)) {
+ if (message.starts_with(prefix)) {
return level;
}
}
diff --git a/yt/yt/core/misc/configurable_singleton_def-inl.h b/yt/yt/core/misc/configurable_singleton_def-inl.h
index cb9dbc76f1..79945d9da2 100644
--- a/yt/yt/core/misc/configurable_singleton_def-inl.h
+++ b/yt/yt/core/misc/configurable_singleton_def-inl.h
@@ -64,8 +64,7 @@ struct TSingletonConfigHelpers
return [=] (NYTree::TYsonStructRegistrar<TManagerConfig> registrar) {
SetupSingletonConfigParameter(
registrar.template ParameterWithUniversalAccessor<TIntrusivePtr<TSingletonConfig>>(
- // TODO(babenko): switch to std::string
- TString(singletonName),
+ singletonName,
[=] (TManagerConfig* config) -> auto& {
auto it = config->NameToConfig_.find(singletonName);
if (it == config->NameToConfig_.end()) {
diff --git a/yt/yt/core/rpc/service_detail.cpp b/yt/yt/core/rpc/service_detail.cpp
index 0943c54744..c374da2d7a 100644
--- a/yt/yt/core/rpc/service_detail.cpp
+++ b/yt/yt/core/rpc/service_detail.cpp
@@ -324,7 +324,9 @@ TServiceBase::TPerformanceCounters::TPerformanceCounters(const NProfiling::TProf
NProfiling::TCounter* TServiceBase::TPerformanceCounters::GetRequestsPerUserAgentCounter(TStringBuf userAgent)
{
return RequestsPerUserAgent_.FindOrInsert(userAgent, [&] {
- return Profiler_.WithRequiredTag("user_agent", TString(userAgent)).Counter("/user_agent");
+ return Profiler_
+ .WithRequiredTag("user_agent", std::string(userAgent))
+ .Counter("/user_agent");
}).first;
}
@@ -2318,7 +2320,6 @@ TServiceBase::TMethodPerformanceCountersPtr TServiceBase::CreateMethodPerformanc
auto profiler = runtimeInfo->Profiler.WithSparse();
if (userTag) {
- // TODO(babenko): migrate to std::string
profiler = profiler.WithTag("user", std::string(userTag));
}
if (runtimeInfo->Descriptor.RequestQueueProvider) {
diff --git a/yt/yt/core/rpc/service_detail.h b/yt/yt/core/rpc/service_detail.h
index f7f937246c..0f6a1323c3 100644
--- a/yt/yt/core/rpc/service_detail.h
+++ b/yt/yt/core/rpc/service_detail.h
@@ -766,7 +766,7 @@ protected:
std::atomic<TDuration> LoggingSuppressionTimeout = {};
using TNonowningPerformanceCountersKey = std::tuple<TStringBuf, TRequestQueue*>;
- using TOwningPerformanceCountersKey = std::tuple<TString, TRequestQueue*>;
+ using TOwningPerformanceCountersKey = std::tuple<std::string, TRequestQueue*>;
using TPerformanceCountersKeyHash = THash<TNonowningPerformanceCountersKey>;
struct TPerformanceCountersKeyEquals
@@ -813,7 +813,7 @@ protected:
const NProfiling::TProfiler Profiler_;
//! Number of requests per user agent.
- NConcurrency::TSyncMap<TString, NProfiling::TCounter> RequestsPerUserAgent_;
+ NConcurrency::TSyncMap<std::string, NProfiling::TCounter, THash<TStringBuf>, TEqualTo<TStringBuf>> RequestsPerUserAgent_;
};
using TPerformanceCountersPtr = TIntrusivePtr<TPerformanceCounters>;
diff --git a/yt/yt/core/ytree/attributes.cpp b/yt/yt/core/ytree/attributes.cpp
index 96f69f33c8..6d20ee6379 100644
--- a/yt/yt/core/ytree/attributes.cpp
+++ b/yt/yt/core/ytree/attributes.cpp
@@ -28,8 +28,7 @@ TYsonString IAttributeDictionary::GetYsonAndRemove(TKeyView key)
void IAttributeDictionary::MergeFrom(const IMapNodePtr& other)
{
for (const auto& [key, value] : other->GetChildren()) {
- // TODO(babenko): migrate to std::string
- SetYson(TString(key), ConvertToYsonString(value));
+ SetYson(key, ConvertToYsonString(value));
}
}
@@ -64,8 +63,7 @@ IAttributeDictionaryPtr IAttributeDictionary::FromMap(const IMapNodePtr& node)
auto attributes = CreateEphemeralAttributes();
auto children = node->GetChildren();
for (int index = 0; index < std::ssize(children); ++index) {
- // TODO(babenko): migrate to std::string
- attributes->SetYson(TString(children[index].first), ConvertToYsonString(children[index].second));
+ attributes->SetYson(children[index].first, ConvertToYsonString(children[index].second));
}
return attributes;
}
diff --git a/yt/yt/core/ytree/yson_struct-inl.h b/yt/yt/core/ytree/yson_struct-inl.h
index ab5b695dce..9ef10db1b5 100644
--- a/yt/yt/core/ytree/yson_struct-inl.h
+++ b/yt/yt/core/ytree/yson_struct-inl.h
@@ -337,8 +337,7 @@ THashMap<TKey, TIntrusivePtr<TValue>> CloneYsonStructs(const THashMap<TKey, TInt
THashMap<TKey, TIntrusivePtr<TValue>> clonedObjs;
clonedObjs.reserve(objs.size());
for (const auto& [key, obj] : objs) {
- // TODO(babenko): switch to std::string
- clonedObjs.emplace(std::string(key), CloneYsonStruct(obj));
+ clonedObjs.emplace(key, CloneYsonStruct(obj));
}
return clonedObjs;
}