Skip to content

Commit 92c53fa

Browse files
committed
Merge branch 'rightlib' into merge-libs-250223-0050
2 parents 68803c1 + 33fd3a3 commit 92c53fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+180
-182
lines changed

library/cpp/tld/tlds-alpha-by-domain.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version 2025021300, Last Updated Thu Feb 13 07:07:02 2025 UTC
1+
# Version 2025022200, Last Updated Sat Feb 22 07:07:01 2025 UTC
22
AAA
33
AARP
44
ABB

library/cpp/yt/backtrace/backtrace.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ namespace NYT::NBacktrace {
44

55
////////////////////////////////////////////////////////////////////////////////
66

7-
TString SymbolizeBacktrace(TBacktrace backtrace)
7+
std::string SymbolizeBacktrace(TBacktrace backtrace)
88
{
9-
TString result;
9+
std::string result;
1010
SymbolizeBacktrace(
1111
backtrace,
1212
[&] (TStringBuf str) { result += str; });

library/cpp/yt/backtrace/backtrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void SymbolizeBacktrace(
3434
/*!
3535
* \param backtrace Backtrace to symbolize
3636
*/
37-
TString SymbolizeBacktrace(TBacktrace backtrace);
37+
std::string SymbolizeBacktrace(TBacktrace backtrace);
3838

3939
////////////////////////////////////////////////////////////////////////////////
4040

library/cpp/yt/coding/unittests/varint_ut.cpp

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ using ::testing::Values;
1515

1616
////////////////////////////////////////////////////////////////////////////////
1717

18-
class TWriteVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, TString> >
18+
class TWriteVarIntTest
19+
: public ::testing::TestWithParam<std::tuple<ui64, std::string>>
1920
{ };
2021

2122
TEST_P(TWriteVarIntTest, Serialization)
2223
{
2324
ui64 value = std::get<0>(GetParam());
24-
TString rightAnswer = std::get<1>(GetParam());
25+
std::string rightAnswer = std::get<1>(GetParam());
2526

2627
TStringStream outputStream;
2728
WriteVarUint64(&outputStream, value);
@@ -30,13 +31,13 @@ TEST_P(TWriteVarIntTest, Serialization)
3031

3132
////////////////////////////////////////////////////////////////////////////////
3233

33-
class TReadVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, TString> >
34+
class TReadVarIntTest: public ::testing::TestWithParam<std::tuple<ui64, std::string> >
3435
{ };
3536

3637
TEST_P(TReadVarIntTest, Serialization)
3738
{
3839
ui64 rightAnswer = std::get<0>(GetParam());
39-
TString input = std::get<1>(GetParam());
40+
auto input = TString(std::get<1>(GetParam()));
4041

4142
TStringInput inputStream(input);
4243
ui64 value;
@@ -56,34 +57,34 @@ TEST(TReadVarIntTest, Overflow)
5657

5758
auto ValuesForVarIntTests = Values(
5859
// Simple cases.
59-
std::make_tuple(0x0ull, TString("\x00", 1)),
60-
std::make_tuple(0x1ull, TString("\x01", 1)),
61-
std::make_tuple(0x2ull, TString("\x02", 1)),
62-
std::make_tuple(0x3ull, TString("\x03", 1)),
63-
std::make_tuple(0x4ull, TString("\x04", 1)),
60+
std::make_tuple(0x0ull, std::string("\x00", 1)),
61+
std::make_tuple(0x1ull, std::string("\x01", 1)),
62+
std::make_tuple(0x2ull, std::string("\x02", 1)),
63+
std::make_tuple(0x3ull, std::string("\x03", 1)),
64+
std::make_tuple(0x4ull, std::string("\x04", 1)),
6465

6566
// The following "magic numbers" are critical points for varint encoding.
66-
std::make_tuple((1ull << 7) - 1, TString("\x7f", 1)),
67-
std::make_tuple((1ull << 7), TString("\x80\x01", 2)),
68-
std::make_tuple((1ull << 14) - 1, TString("\xff\x7f", 2)),
69-
std::make_tuple((1ull << 14), TString("\x80\x80\x01", 3)),
70-
std::make_tuple((1ull << 21) - 1, TString("\xff\xff\x7f", 3)),
71-
std::make_tuple((1ull << 21), TString("\x80\x80\x80\x01", 4)),
72-
std::make_tuple((1ull << 28) - 1, TString("\xff\xff\xff\x7f", 4)),
73-
std::make_tuple((1ull << 28), TString("\x80\x80\x80\x80\x01", 5)),
74-
std::make_tuple((1ull << 35) - 1, TString("\xff\xff\xff\xff\x7f", 5)),
75-
std::make_tuple((1ull << 35), TString("\x80\x80\x80\x80\x80\x01", 6)),
76-
std::make_tuple((1ull << 42) - 1, TString("\xff\xff\xff\xff\xff\x7f", 6)),
77-
std::make_tuple((1ull << 42), TString("\x80\x80\x80\x80\x80\x80\x01", 7)),
78-
std::make_tuple((1ull << 49) - 1, TString("\xff\xff\xff\xff\xff\xff\x7f", 7)),
79-
std::make_tuple((1ull << 49), TString("\x80\x80\x80\x80\x80\x80\x80\x01", 8)),
80-
std::make_tuple((1ull << 56) - 1, TString("\xff\xff\xff\xff\xff\xff\xff\x7f", 8)),
81-
std::make_tuple((1ull << 56), TString("\x80\x80\x80\x80\x80\x80\x80\x80\x01", 9)),
82-
std::make_tuple((1ull << 63) - 1, TString("\xff\xff\xff\xff\xff\xff\xff\xff\x7f", 9)),
83-
std::make_tuple((1ull << 63), TString("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01", 10)),
67+
std::make_tuple((1ull << 7) - 1, std::string("\x7f", 1)),
68+
std::make_tuple((1ull << 7), std::string("\x80\x01", 2)),
69+
std::make_tuple((1ull << 14) - 1, std::string("\xff\x7f", 2)),
70+
std::make_tuple((1ull << 14), std::string("\x80\x80\x01", 3)),
71+
std::make_tuple((1ull << 21) - 1, std::string("\xff\xff\x7f", 3)),
72+
std::make_tuple((1ull << 21), std::string("\x80\x80\x80\x01", 4)),
73+
std::make_tuple((1ull << 28) - 1, std::string("\xff\xff\xff\x7f", 4)),
74+
std::make_tuple((1ull << 28), std::string("\x80\x80\x80\x80\x01", 5)),
75+
std::make_tuple((1ull << 35) - 1, std::string("\xff\xff\xff\xff\x7f", 5)),
76+
std::make_tuple((1ull << 35), std::string("\x80\x80\x80\x80\x80\x01", 6)),
77+
std::make_tuple((1ull << 42) - 1, std::string("\xff\xff\xff\xff\xff\x7f", 6)),
78+
std::make_tuple((1ull << 42), std::string("\x80\x80\x80\x80\x80\x80\x01", 7)),
79+
std::make_tuple((1ull << 49) - 1, std::string("\xff\xff\xff\xff\xff\xff\x7f", 7)),
80+
std::make_tuple((1ull << 49), std::string("\x80\x80\x80\x80\x80\x80\x80\x01", 8)),
81+
std::make_tuple((1ull << 56) - 1, std::string("\xff\xff\xff\xff\xff\xff\xff\x7f", 8)),
82+
std::make_tuple((1ull << 56), std::string("\x80\x80\x80\x80\x80\x80\x80\x80\x01", 9)),
83+
std::make_tuple((1ull << 63) - 1, std::string("\xff\xff\xff\xff\xff\xff\xff\xff\x7f", 9)),
84+
std::make_tuple((1ull << 63), std::string("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01", 10)),
8485

8586
// Boundary case.
86-
std::make_tuple(static_cast<ui64>(-1), TString("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 10))
87+
std::make_tuple(static_cast<ui64>(-1), std::string("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 10))
8788
);
8889

8990
INSTANTIATE_TEST_SUITE_P(ValueParametrized, TWriteVarIntTest,

library/cpp/yt/compact_containers/unittests/compact_vector_ut.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ TYPED_TEST(CompactVectorTest, InsertEnd)
273273
{
274274
SCOPED_TRACE("InsertEnd");
275275

276-
TCompactVector<TString, 5> vector;
276+
TCompactVector<std::string, 5> vector;
277277
for (int index = 0; index < 10; ++index) {
278278
vector.insert(vector.end(), ToString(index));
279279
}
@@ -286,7 +286,7 @@ TYPED_TEST(CompactVectorTest, ShrinkToSmall)
286286
{
287287
SCOPED_TRACE("ShrinkToSmall");
288288

289-
TCompactVector<TString, 5> vector;
289+
TCompactVector<std::string, 5> vector;
290290
for (int index = 0; index < 10; ++index) {
291291
vector.shrink_to_small();
292292
vector.push_back(ToString(index));
@@ -1061,19 +1061,19 @@ TEST(CompactVectorTest, InitializerList) {
10611061
}
10621062

10631063
TEST(CompactVectorTest, AssignToShorter) {
1064-
TCompactVector<TString, 4> lhs;
1065-
TCompactVector<TString, 4> rhs;
1064+
TCompactVector<std::string, 4> lhs;
1065+
TCompactVector<std::string, 4> rhs;
10661066
rhs.emplace_back("foo");
10671067
lhs = rhs;
10681068
EXPECT_EQ(1U, lhs.size());
10691069
EXPECT_EQ("foo", lhs[0]);
10701070
}
10711071

10721072
TEST(CompactVectorTest, AssignToLonger) {
1073-
TCompactVector<TString, 4> lhs;
1073+
TCompactVector<std::string, 4> lhs;
10741074
lhs.emplace_back("bar");
10751075
lhs.emplace_back("baz");
1076-
TCompactVector<TString, 4> rhs;
1076+
TCompactVector<std::string, 4> rhs;
10771077
rhs.emplace_back("foo");
10781078
lhs = rhs;
10791079
EXPECT_EQ(1U, lhs.size());

library/cpp/yt/error/error-inl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ constexpr bool TErrorCode::operator == (TErrorCode rhs) const
5555
namespace NDetail {
5656

5757
template <class... TArgs>
58-
TString FormatErrorMessage(TStringBuf format, TArgs&&... args)
58+
std::string FormatErrorMessage(TStringBuf format, TArgs&&... args)
5959
{
6060
return Format(TRuntimeFormat{format}, std::forward<TArgs>(args)...);
6161
}
6262

63-
inline TString FormatErrorMessage(TStringBuf format)
63+
inline std::string FormatErrorMessage(TStringBuf format)
6464
{
65-
return TString(format);
65+
return std::string(format);
6666
}
6767

6868
} // namespace NDetail

library/cpp/yt/error/error.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ class TError::TImpl
4646
, InnerErrors_(other.InnerErrors_)
4747
{ }
4848

49-
explicit TImpl(TString message)
49+
explicit TImpl(std::string message)
5050
: Code_(NYT::EErrorCode::Generic)
5151
, Message_(std::move(message))
5252
{
5353
OriginAttributes_.Capture();
5454
}
5555

56-
TImpl(TErrorCode code, TString message)
56+
TImpl(TErrorCode code, std::string message)
5757
: Code_(code)
5858
, Message_(std::move(message))
5959
{
@@ -77,12 +77,12 @@ class TError::TImpl
7777
Code_ = code;
7878
}
7979

80-
const TString& GetMessage() const noexcept
80+
const std::string& GetMessage() const noexcept
8181
{
8282
return Message_;
8383
}
8484

85-
TString* MutableMessage() noexcept
85+
std::string* MutableMessage() noexcept
8686
{
8787
return &Message_;
8888
}
@@ -164,7 +164,7 @@ class TError::TImpl
164164

165165
private:
166166
TErrorCode Code_;
167-
TString Message_;
167+
std::string Message_;
168168

169169
TOriginAttributes OriginAttributes_{
170170
.Pid = 0,
@@ -277,11 +277,11 @@ TError::TErrorOr(const std::exception& ex)
277277
YT_VERIFY(!IsOK());
278278
}
279279

280-
TError::TErrorOr(TString message, TDisableFormat)
280+
TError::TErrorOr(std::string message, TDisableFormat)
281281
: Impl_(std::make_unique<TImpl>(std::move(message)))
282282
{ }
283283

284-
TError::TErrorOr(TErrorCode code, TString message, TDisableFormat)
284+
TError::TErrorOr(TErrorCode code, std::string message, TDisableFormat)
285285
: Impl_(std::make_unique<TImpl>(code, std::move(message)))
286286
{ }
287287

@@ -363,16 +363,16 @@ THashSet<TErrorCode> TError::GetDistinctNonTrivialErrorCodes() const
363363
return result;
364364
}
365365

366-
const TString& TError::GetMessage() const
366+
const std::string& TError::GetMessage() const
367367
{
368368
if (!Impl_) {
369-
static const TString Result;
369+
static const std::string Result;
370370
return Result;
371371
}
372372
return Impl_->GetMessage();
373373
}
374374

375-
TError& TError::SetMessage(TString message)
375+
TError& TError::SetMessage(std::string message)
376376
{
377377
MakeMutable();
378378
*Impl_->MutableMessage() = std::move(message);
@@ -422,7 +422,7 @@ NThreading::TThreadId TError::GetTid() const
422422
TStringBuf TError::GetThreadName() const
423423
{
424424
if (!Impl_) {
425-
static TString empty;
425+
static std::string empty;
426426
return empty;
427427
}
428428
return Impl_->GetThreadName();
@@ -482,7 +482,7 @@ void TError::UpdateOriginAttributes()
482482
Impl_->UpdateOriginAttributes();
483483
}
484484

485-
const TString InnerErrorsTruncatedKey("inner_errors_truncated");
485+
const std::string InnerErrorsTruncatedKey("inner_errors_truncated");
486486

487487
TError TError::Truncate(
488488
int maxInnerErrorCount,
@@ -513,8 +513,7 @@ TError TError::Truncate(
513513

514514
auto result = std::make_unique<TImpl>();
515515
result->SetCode(GetCode());
516-
*result->MutableMessage()
517-
= std::move(TruncateString(GetMessage(), stringLimit, ErrorMessageTruncatedSuffix));
516+
*result->MutableMessage() = TruncateString(GetMessage(), stringLimit, ErrorMessageTruncatedSuffix);
518517
if (Impl_->HasAttributes()) {
519518
truncateAttributes(Impl_->Attributes(), result->MutableAttributes());
520519
}
@@ -608,13 +607,13 @@ TError TError::Wrap() &&
608607
return std::move(*this);
609608
}
610609

611-
Y_WEAK TString GetErrorSkeleton(const TError& /*error*/)
610+
Y_WEAK std::string GetErrorSkeleton(const TError& /*error*/)
612611
{
613612
// Proper implementation resides in yt/yt/library/error_skeleton/skeleton.cpp.
614613
THROW_ERROR_EXCEPTION("Error skeleton implementation library is not linked; consider PEERDIR'ing yt/yt/library/error_skeleton");
615614
}
616615

617-
TString TError::GetSkeleton() const
616+
std::string TError::GetSkeleton() const
618617
{
619618
return GetErrorSkeleton(*this);
620619
}
@@ -775,7 +774,7 @@ void AppendError(TStringBuilderBase* builder, const TError& error, int indent)
775774
AppendAttribute(
776775
builder,
777776
"host",
778-
TString{originAttributes->Host},
777+
std::string{originAttributes->Host},
779778
indent);
780779
}
781780

library/cpp/yt/error/error.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class [[nodiscard]] TErrorOr<void>
8383
{ };
8484
static constexpr TDisableFormat DisableFormat = {};
8585

86-
TErrorOr(TString message, TDisableFormat);
87-
TErrorOr(TErrorCode code, TString message, TDisableFormat);
86+
TErrorOr(std::string message, TDisableFormat);
87+
TErrorOr(TErrorCode code, std::string message, TDisableFormat);
8888

8989
template <class... TArgs>
9090
explicit TErrorOr(
@@ -110,8 +110,8 @@ class [[nodiscard]] TErrorOr<void>
110110
TErrorCode GetNonTrivialCode() const;
111111
THashSet<TErrorCode> GetDistinctNonTrivialErrorCodes() const;
112112

113-
const TString& GetMessage() const;
114-
TError& SetMessage(TString message);
113+
const std::string& GetMessage() const;
114+
TError& SetMessage(std::string message);
115115

116116
bool HasOriginAttributes() const;
117117
TProcessId GetPid() const;
@@ -197,7 +197,7 @@ class [[nodiscard]] TErrorOr<void>
197197
//! In order to prevent core -> re2 dependency, implementation belongs to a separate library
198198
//! yt/yt/library/error_skeleton. Calling this method without PEERDIR'ing implementation
199199
//! results in an exception.
200-
TString GetSkeleton() const;
200+
std::string GetSkeleton() const;
201201

202202
TError& operator <<= (const TErrorAttribute& attribute) &;
203203
TError& operator <<= (const std::vector<TErrorAttribute>& attributes) &;
@@ -281,7 +281,7 @@ class TErrorException
281281
const char* what() const noexcept override;
282282

283283
private:
284-
mutable TString CachedWhat_;
284+
mutable std::string CachedWhat_;
285285
};
286286

287287
// Make these templates to avoid type erasure during throw.

library/cpp/yt/error/error_attributes-inl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ template <class T>
5555
requires CConvertibleFromAttributeValue<T>
5656
T TErrorAttributes::GetAndRemove(const TKey& key, const T& defaultValue)
5757
{
58-
auto value = Find<T>(key);
59-
if (value) {
58+
if (auto value = Find<T>(key)) {
6059
Remove(key);
6160
return *value;
6261
} else {

library/cpp/yt/error/error_attributes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace NYT {
1010
////////////////////////////////////////////////////////////////////////////////
1111

1212
// TODO(arkady-e1ppa): Try switching to TString/std::string eventually.
13-
// representing text-encoded yson string eventually (maybe).
13+
// representing text-encoded YSON string eventually (maybe).
1414
class TErrorAttributes
1515
{
1616
public:

0 commit comments

Comments
 (0)