Skip to content

Commit c890e9d

Browse files
author
babenko
committed
YT-22593: And even more trivial TString->std::string migrations
commit_hash:b9219ac687ce03d9fb08849ad0629e7b471a7642
1 parent 59afaa0 commit c890e9d

File tree

11 files changed

+25
-29
lines changed

11 files changed

+25
-29
lines changed

yt/yt/client/api/operation_client.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ struct TGetJobFailContextOptions
114114
struct TListOperationsAccessFilter
115115
: public NYTree::TYsonStruct
116116
{
117-
TString Subject;
117+
std::string Subject;
118118
NYTree::EPermissionSet Permissions;
119119

120120
// This parameter cannot be set from YSON, it must be computed.
121-
THashSet<TString> SubjectTransitiveClosure;
121+
THashSet<std::string> SubjectTransitiveClosure;
122122

123123
REGISTER_YSON_STRUCT(TListOperationsAccessFilter);
124124

@@ -303,7 +303,7 @@ struct TOperation
303303
std::optional<TInstant> StartTime;
304304
std::optional<TInstant> FinishTime;
305305

306-
std::optional<TString> AuthenticatedUser;
306+
std::optional<std::string> AuthenticatedUser;
307307

308308
NYson::TYsonString BriefSpec;
309309
NYson::TYsonString Spec;
@@ -319,7 +319,7 @@ struct TOperation
319319
NYson::TYsonString RuntimeParameters;
320320

321321
std::optional<bool> Suspended;
322-
std::optional<TString> SuspendReason;
322+
std::optional<std::string> SuspendReason;
323323

324324
NYson::TYsonString Events;
325325
NYson::TYsonString Result;

yt/yt/client/security_client/acl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ TSerializableAccessControlEntry::TSerializableAccessControlEntry() = default;
1616

1717
TSerializableAccessControlEntry::TSerializableAccessControlEntry(
1818
ESecurityAction action,
19-
std::vector<TString> subjects,
19+
std::vector<std::string> subjects,
2020
EPermissionSet permissions,
2121
EAceInheritanceMode inheritanceMode)
2222
: Action(action)

yt/yt/client/security_client/acl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ namespace NYT::NSecurityClient {
1717
struct TSerializableAccessControlEntry
1818
{
1919
ESecurityAction Action = ESecurityAction::Undefined;
20-
std::vector<TString> Subjects;
20+
std::vector<std::string> Subjects;
2121
NYTree::EPermissionSet Permissions;
2222
EAceInheritanceMode InheritanceMode = EAceInheritanceMode::ObjectAndDescendants;
23-
TString SubjectTagFilter;
23+
std::optional<std::string> SubjectTagFilter;
2424
std::optional<std::vector<std::string>> Columns;
2525
std::optional<bool> Vital;
2626

2727
TSerializableAccessControlEntry(
2828
ESecurityAction action,
29-
std::vector<TString> subjects,
29+
std::vector<std::string> subjects,
3030
NYTree::EPermissionSet permissions,
3131
EAceInheritanceMode inheritanceMode = EAceInheritanceMode::ObjectAndDescendants);
3232

yt/yt/client/security_client/helpers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ TYPath GetUserPath(const std::string& name)
1515
return "//sys/users/" + ToYPathLiteral(name);
1616
}
1717

18-
TYPath GetGroupPath(const TString& name)
18+
TYPath GetGroupPath(const std::string& name)
1919
{
2020
return "//sys/groups/" + ToYPathLiteral(name);
2121
}
2222

23-
TYPath GetAccountPath(const TString& name)
23+
TYPath GetAccountPath(const std::string& name)
2424
{
2525
return "//sys/accounts/" + ToYPathLiteral(name);
2626
}
@@ -29,15 +29,15 @@ TYPath GetAccountPath(const TString& name)
2929

3030
ESecurityAction CheckPermissionsByAclAndSubjectClosure(
3131
const TSerializableAccessControlList& acl,
32-
const THashSet<TString>& subjectClosure,
32+
const THashSet<std::string>& subjectClosure,
3333
NYTree::EPermissionSet permissions)
3434
{
3535
NYTree::EPermissionSet allowedPermissions = {};
3636
NYTree::EPermissionSet deniedPermissions = {};
3737

3838
for (const auto& ace : acl.Entries) {
3939
if (ace.Action != NSecurityClient::ESecurityAction::Allow && ace.Action != NSecurityClient::ESecurityAction::Deny) {
40-
THROW_ERROR_EXCEPTION("Action %Qv is not supported", FormatEnum(ace.Action));
40+
THROW_ERROR_EXCEPTION("Action %Qlv is not supported", ace.Action);
4141
}
4242
for (const auto& aceSubject : ace.Subjects) {
4343
if (subjectClosure.contains(aceSubject)) {

yt/yt/client/security_client/helpers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ namespace NYT::NSecurityClient {
1212
////////////////////////////////////////////////////////////////////////////////
1313

1414
NYPath::TYPath GetUserPath(const std::string& name);
15-
NYPath::TYPath GetGroupPath(const TString& name);
16-
NYPath::TYPath GetAccountPath(const TString& name);
15+
NYPath::TYPath GetGroupPath(const std::string& name);
16+
NYPath::TYPath GetAccountPath(const std::string& name);
1717

1818
////////////////////////////////////////////////////////////////////////////////
1919

2020
ESecurityAction CheckPermissionsByAclAndSubjectClosure(
2121
const TSerializableAccessControlList& acl,
22-
const THashSet<TString>& subjectClosure,
22+
const THashSet<std::string>& subjectClosure,
2323
NYTree::EPermissionSet permissions);
2424

2525
void ValidateSecurityTag(const TSecurityTag& tag);

yt/yt/client/ypath/rich.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,7 @@ std::optional<std::string> TRichYPath::GetCluster() const
662662

663663
void TRichYPath::SetCluster(const std::string& value)
664664
{
665-
// TODO(babenko): switch to std::string
666-
Attributes().Set("cluster", TString(value));
665+
Attributes().Set("cluster", value);
667666
}
668667

669668
std::optional<std::vector<TString>> TRichYPath::GetClusters() const

yt/yt/core/misc/configurable_singleton_def-inl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ struct TSingletonConfigHelpers
6464
return [=] (NYTree::TYsonStructRegistrar<TManagerConfig> registrar) {
6565
SetupSingletonConfigParameter(
6666
registrar.template ParameterWithUniversalAccessor<TIntrusivePtr<TSingletonConfig>>(
67-
// TODO(babenko): switch to std::string
68-
TString(singletonName),
67+
singletonName,
6968
[=] (TManagerConfig* config) -> auto& {
7069
auto it = config->NameToConfig_.find(singletonName);
7170
if (it == config->NameToConfig_.end()) {

yt/yt/core/rpc/service_detail.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ TServiceBase::TPerformanceCounters::TPerformanceCounters(const NProfiling::TProf
324324
NProfiling::TCounter* TServiceBase::TPerformanceCounters::GetRequestsPerUserAgentCounter(TStringBuf userAgent)
325325
{
326326
return RequestsPerUserAgent_.FindOrInsert(userAgent, [&] {
327-
return Profiler_.WithRequiredTag("user_agent", TString(userAgent)).Counter("/user_agent");
327+
return Profiler_
328+
.WithRequiredTag("user_agent", std::string(userAgent))
329+
.Counter("/user_agent");
328330
}).first;
329331
}
330332

@@ -2318,7 +2320,6 @@ TServiceBase::TMethodPerformanceCountersPtr TServiceBase::CreateMethodPerformanc
23182320

23192321
auto profiler = runtimeInfo->Profiler.WithSparse();
23202322
if (userTag) {
2321-
// TODO(babenko): migrate to std::string
23222323
profiler = profiler.WithTag("user", std::string(userTag));
23232324
}
23242325
if (runtimeInfo->Descriptor.RequestQueueProvider) {

yt/yt/core/rpc/service_detail.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ class TServiceBase
766766
std::atomic<TDuration> LoggingSuppressionTimeout = {};
767767

768768
using TNonowningPerformanceCountersKey = std::tuple<TStringBuf, TRequestQueue*>;
769-
using TOwningPerformanceCountersKey = std::tuple<TString, TRequestQueue*>;
769+
using TOwningPerformanceCountersKey = std::tuple<std::string, TRequestQueue*>;
770770
using TPerformanceCountersKeyHash = THash<TNonowningPerformanceCountersKey>;
771771

772772
struct TPerformanceCountersKeyEquals
@@ -813,7 +813,7 @@ class TServiceBase
813813
const NProfiling::TProfiler Profiler_;
814814

815815
//! Number of requests per user agent.
816-
NConcurrency::TSyncMap<TString, NProfiling::TCounter> RequestsPerUserAgent_;
816+
NConcurrency::TSyncMap<std::string, NProfiling::TCounter, THash<TStringBuf>, TEqualTo<TStringBuf>> RequestsPerUserAgent_;
817817
};
818818

819819
using TPerformanceCountersPtr = TIntrusivePtr<TPerformanceCounters>;

yt/yt/core/ytree/attributes.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ TYsonString IAttributeDictionary::GetYsonAndRemove(TKeyView key)
2828
void IAttributeDictionary::MergeFrom(const IMapNodePtr& other)
2929
{
3030
for (const auto& [key, value] : other->GetChildren()) {
31-
// TODO(babenko): migrate to std::string
32-
SetYson(TString(key), ConvertToYsonString(value));
31+
SetYson(key, ConvertToYsonString(value));
3332
}
3433
}
3534

@@ -64,8 +63,7 @@ IAttributeDictionaryPtr IAttributeDictionary::FromMap(const IMapNodePtr& node)
6463
auto attributes = CreateEphemeralAttributes();
6564
auto children = node->GetChildren();
6665
for (int index = 0; index < std::ssize(children); ++index) {
67-
// TODO(babenko): migrate to std::string
68-
attributes->SetYson(TString(children[index].first), ConvertToYsonString(children[index].second));
66+
attributes->SetYson(children[index].first, ConvertToYsonString(children[index].second));
6967
}
7068
return attributes;
7169
}

0 commit comments

Comments
 (0)