diff options
author | babenko <babenko@yandex-team.com> | 2025-02-22 17:31:05 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2025-02-22 18:01:12 +0300 |
commit | c890e9d1c527ae09d2441668e432f4be83a27efe (patch) | |
tree | 1a63bdcac8810560e7fdb4814fb796da165a782d | |
parent | 59afaa0cb7cd89146dd10f5446256afcce33bd0e (diff) | |
download | ydb-c890e9d1c527ae09d2441668e432f4be83a27efe.tar.gz |
YT-22593: And even more trivial TString->std::string migrations
commit_hash:b9219ac687ce03d9fb08849ad0629e7b471a7642
-rw-r--r-- | yt/yt/client/api/operation_client.h | 8 | ||||
-rw-r--r-- | yt/yt/client/security_client/acl.cpp | 2 | ||||
-rw-r--r-- | yt/yt/client/security_client/acl.h | 6 | ||||
-rw-r--r-- | yt/yt/client/security_client/helpers.cpp | 8 | ||||
-rw-r--r-- | yt/yt/client/security_client/helpers.h | 6 | ||||
-rw-r--r-- | yt/yt/client/ypath/rich.cpp | 3 | ||||
-rw-r--r-- | yt/yt/core/misc/configurable_singleton_def-inl.h | 3 | ||||
-rw-r--r-- | yt/yt/core/rpc/service_detail.cpp | 5 | ||||
-rw-r--r-- | yt/yt/core/rpc/service_detail.h | 4 | ||||
-rw-r--r-- | yt/yt/core/ytree/attributes.cpp | 6 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct-inl.h | 3 |
11 files changed, 25 insertions, 29 deletions
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/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/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; } |