diff options
author | babenko <babenko@yandex-team.com> | 2025-02-15 17:33:30 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2025-02-15 17:49:26 +0300 |
commit | fd0d7feaceb3963c15f0c22e26940ebb43e91e9b (patch) | |
tree | f487d89cd084173c83d97f67c6779df9e3e3e547 | |
parent | 63e9f6ad89146798a8ca0fd489dd0f6b8d8a9f07 (diff) | |
download | ydb-fd0d7feaceb3963c15f0c22e26940ebb43e91e9b.tar.gz |
YT-22593: Migrate Yson Struct to std::string
commit_hash:835651ea93912dc3740a84bf06c3dc17ba166ea8
-rw-r--r-- | yt/yt/core/ytree/yson_struct-inl.h | 12 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct.cpp | 14 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct.h | 24 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct_detail-inl.h | 14 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct_detail.cpp | 22 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct_detail.h | 46 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct_update-inl.h | 2 | ||||
-rw-r--r-- | yt/yt/core/ytree/yson_struct_update.h | 2 |
8 files changed, 68 insertions, 68 deletions
diff --git a/yt/yt/core/ytree/yson_struct-inl.h b/yt/yt/core/ytree/yson_struct-inl.h index 6f56b6bd48..ab5b695dce 100644 --- a/yt/yt/core/ytree/yson_struct-inl.h +++ b/yt/yt/core/ytree/yson_struct-inl.h @@ -171,14 +171,14 @@ TYsonStructRegistrar<TStruct>::TYsonStructRegistrar(IYsonStructMeta* meta) template <class TStruct> template <class TValue> -TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::Parameter(const TString& key, TValue(TStruct::*field)) +TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::Parameter(const std::string& key, TValue(TStruct::*field)) { return BaseClassParameter<TStruct, TValue>(key, field); } template <class TStruct> template <class TBase, class TValue> -TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::BaseClassParameter(const TString& key, TValue(TBase::*field)) +TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::BaseClassParameter(const std::string& key, TValue(TBase::*field)) { static_assert(std::derived_from<TStruct, TBase>); int fieldIndex = ssize(Meta_->GetParameterMap()); @@ -189,7 +189,7 @@ TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::BaseClassParameter( template <class TStruct> template <class TValue> -TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::ParameterWithUniversalAccessor(const TString& key, std::function<TValue&(TStruct*)> accessor) +TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::ParameterWithUniversalAccessor(const std::string& key, std::function<TValue&(TStruct*)> accessor) { int fieldIndex = ssize(Meta_->GetParameterMap()); auto parameter = New<TYsonStructParameter<TValue>>(key, std::make_unique<TUniversalYsonParameterAccessor<TStruct, TValue>>(std::move(accessor)), fieldIndex); @@ -216,7 +216,7 @@ void TYsonStructRegistrar<TStruct>::Postprocessor(std::function<void(TStruct*)> template <class TStruct> template <class TExternal, class TValue> // requires std::derived_from<TStruct, TExternalizedYsonStruct<TExternal, TStruct>> -TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::ExternalClassParameter(const TString& key, TValue(TExternal::*field)) +TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::ExternalClassParameter(const std::string& key, TValue(TExternal::*field)) { static_assert(std::derived_from<TStruct, TExternalizedYsonStruct>); static_assert(std::same_as<typename TStruct::TExternal, TExternal>); @@ -251,7 +251,7 @@ void TYsonStructRegistrar<TStruct>::ExternalPostprocessor(TExternalPostprocessor template <class TStruct> template <class TBase, class TValue> -TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::ExternalBaseClassParameter(const TString& key, TValue(TBase::*field)) +TYsonStructParameter<TValue>& TYsonStructRegistrar<TStruct>::ExternalBaseClassParameter(const std::string& key, TValue(TBase::*field)) { static_assert(std::derived_from<TStruct, TExternalizedYsonStruct>); static_assert(std::derived_from<typename TStruct::TExternal, TBase>); @@ -338,7 +338,7 @@ THashMap<TKey, TIntrusivePtr<TValue>> CloneYsonStructs(const THashMap<TKey, TInt clonedObjs.reserve(objs.size()); for (const auto& [key, obj] : objs) { // TODO(babenko): switch to std::string - clonedObjs.emplace(TString(key), CloneYsonStruct(obj)); + clonedObjs.emplace(std::string(key), CloneYsonStruct(obj)); } return clonedObjs; } diff --git a/yt/yt/core/ytree/yson_struct.cpp b/yt/yt/core/ytree/yson_struct.cpp index 42983a33a9..41e6c3de2f 100644 --- a/yt/yt/core/ytree/yson_struct.cpp +++ b/yt/yt/core/ytree/yson_struct.cpp @@ -55,7 +55,7 @@ void TYsonStructBase::SetUnrecognizedStrategy(EUnrecognizedStrategy strategy) InstanceUnrecognizedStrategy_ = strategy; } -THashSet<TString> TYsonStructBase::GetRegisteredKeys() const +THashSet<std::string> TYsonStructBase::GetRegisteredKeys() const { return Meta_->GetRegisteredKeys(); } @@ -128,17 +128,17 @@ void TYsonStructBase::SetDefaults() Meta_->SetDefaultsOfInitializedStruct(this); } -void TYsonStructBase::SaveParameter(const TString& key, IYsonConsumer* consumer) const +void TYsonStructBase::SaveParameter(const std::string& key, IYsonConsumer* consumer) const { Meta_->GetParameter(key)->Save(this, consumer); } -void TYsonStructBase::LoadParameter(const TString& key, const NYTree::INodePtr& node) +void TYsonStructBase::LoadParameter(const std::string& key, const NYTree::INodePtr& node) { Meta_->LoadParameter(this, key, node); } -void TYsonStructBase::ResetParameter(const TString& key) +void TYsonStructBase::ResetParameter(const std::string& key) { Meta_->GetParameter(key)->SetDefaultsInitialized(this); } @@ -148,7 +148,7 @@ int TYsonStructBase::GetParameterCount() const return Meta_->GetParameterMap().size(); } -std::vector<TString> TYsonStructBase::GetAllParameterAliases(const TString& key) const +std::vector<std::string> TYsonStructBase::GetAllParameterAliases(const std::string& key) const { auto parameter = Meta_->GetParameter(key); auto result = parameter->GetAliases(); @@ -181,7 +181,7 @@ void TYsonStruct::InitializeRefCounted() } } -bool TYsonStruct::IsSet(const TString& key) const +bool TYsonStruct::IsSet(const std::string& key) const { return SetFields_[Meta_->GetParameter(key)->GetFieldIndex()]; } @@ -200,7 +200,7 @@ TCompactBitmap* TYsonStructLite::GetSetFieldsBitmap() //////////////////////////////////////////////////////////////////////////////// -bool TYsonStructLiteWithFieldTracking::IsSet(const TString& key) const +bool TYsonStructLiteWithFieldTracking::IsSet(const std::string& key) const { return SetFields_[Meta_->GetParameter(key)->GetFieldIndex()]; } diff --git a/yt/yt/core/ytree/yson_struct.h b/yt/yt/core/ytree/yson_struct.h index 84be291e8f..62837542e6 100644 --- a/yt/yt/core/ytree/yson_struct.h +++ b/yt/yt/core/ytree/yson_struct.h @@ -97,15 +97,15 @@ public: void SetUnrecognizedStrategy(EUnrecognizedStrategy strategy); - THashSet<TString> GetRegisteredKeys() const; + THashSet<std::string> GetRegisteredKeys() const; int GetParameterCount() const; // TODO(renadeen): remove this methods. - void SaveParameter(const TString& key, NYson::IYsonConsumer* consumer) const; - void LoadParameter(const TString& key, const NYTree::INodePtr& node); - void ResetParameter(const TString& key); + void SaveParameter(const std::string& key, NYson::IYsonConsumer* consumer) const; + void LoadParameter(const std::string& key, const NYTree::INodePtr& node); + void ResetParameter(const std::string& key); - std::vector<TString> GetAllParameterAliases(const TString& key) const; + std::vector<std::string> GetAllParameterAliases(const std::string& key) const; void WriteSchema(NYson::IYsonConsumer* consumer) const; @@ -149,7 +149,7 @@ class TYsonStruct public: void InitializeRefCounted(); - bool IsSet(const TString& key) const; + bool IsSet(const std::string& key) const; private: TCompactBitmap SetFields_; @@ -192,7 +192,7 @@ public: TYsonStructLiteWithFieldTracking(TYsonStructLiteWithFieldTracking&& other) = default; TYsonStructLiteWithFieldTracking& operator=(TYsonStructLiteWithFieldTracking&& other) = default; - bool IsSet(const TString& key) const; + bool IsSet(const std::string& key) const; private: TCompactBitmap SetFields_; @@ -326,13 +326,13 @@ public: explicit TYsonStructRegistrar(IYsonStructMeta* meta); template <class TValue> - TYsonStructParameter<TValue>& Parameter(const TString& key, TValue(TStruct::*field)); + TYsonStructParameter<TValue>& Parameter(const std::string& key, TValue(TStruct::*field)); template <class TBase, class TValue> - TYsonStructParameter<TValue>& BaseClassParameter(const TString& key, TValue(TBase::*field)); + TYsonStructParameter<TValue>& BaseClassParameter(const std::string& key, TValue(TBase::*field)); template <class TValue> - TYsonStructParameter<TValue>& ParameterWithUniversalAccessor(const TString& key, std::function<TValue&(TStruct*)> accessor); + TYsonStructParameter<TValue>& ParameterWithUniversalAccessor(const std::string& key, std::function<TValue&(TStruct*)> accessor); void Preprocessor(std::function<void(TStruct*)> preprocessor); @@ -352,10 +352,10 @@ public: template <class TExternal, class TValue> // requires std::derived_from<TStruct, TExternalizedYsonStruct<TExternal, TStruct>> - TYsonStructParameter<TValue>& ExternalClassParameter(const TString& key, TValue(TExternal::*field)); + TYsonStructParameter<TValue>& ExternalClassParameter(const std::string& key, TValue(TExternal::*field)); template <class TBase, class TValue> - TYsonStructParameter<TValue>& ExternalBaseClassParameter(const TString& key, TValue(TBase::*field)); + TYsonStructParameter<TValue>& ExternalBaseClassParameter(const std::string& key, TValue(TBase::*field)); template <class TExternalPreprocessor> // requires (CInvocable<TExternalPreprocessor, void(typename TStruct::TExternal*)>) diff --git a/yt/yt/core/ytree/yson_struct_detail-inl.h b/yt/yt/core/ytree/yson_struct_detail-inl.h index 0212d1bdb3..67e4a9c2f6 100644 --- a/yt/yt/core/ytree/yson_struct_detail-inl.h +++ b/yt/yt/core/ytree/yson_struct_detail-inl.h @@ -188,7 +188,7 @@ struct TYsonSourceTraits<NYson::TYsonPullParserCursor*> static void FillMap(NYson::TYsonPullParserCursor*& source, TMap& map, TFiller filler) { source->ParseMap([&] (NYson::TYsonPullParserCursor* cursor) { - auto key = ExtractTo<TString>(cursor); + auto key = ExtractTo<std::string>(cursor); filler(map, std::move(key), source); }); } @@ -439,7 +439,7 @@ void LoadFromSource( using TValue = typename TMap::mapped_type; try { - TTraits::FillMap(source, parameter, [&] (TMap& map, const TString& key, auto childSource) { + TTraits::FillMap(source, parameter, [&] (TMap& map, const std::string& key, auto childSource) { TValue value; LoadFromSource( value, @@ -785,7 +785,7 @@ TValue& TUniversalYsonParameterAccessor<TStruct, TValue>::GetValue(const TYsonSt template <class TValue> TYsonStructParameter<TValue>::TYsonStructParameter( - TString key, + std::string key, std::unique_ptr<IYsonFieldAccessor<TValue>> fieldAccessor, int fieldIndex) : Key_(std::move(key)) @@ -942,7 +942,7 @@ bool TYsonStructParameter<TValue>::CanOmitValue(const TYsonStructBase* self) con } template <class TValue> -TYsonStructParameter<TValue>& TYsonStructParameter<TValue>::Alias(const TString& name) +TYsonStructParameter<TValue>& TYsonStructParameter<TValue>::Alias(const std::string& name) { Aliases_.push_back(name); return *this; @@ -970,7 +970,7 @@ TYsonStructParameter<TValue>& TYsonStructParameter<TValue>::EnforceDefaultUnreco } template <class TValue> -const std::vector<TString>& TYsonStructParameter<TValue>::GetAliases() const +const std::vector<std::string>& TYsonStructParameter<TValue>::GetAliases() const { return Aliases_; } @@ -982,7 +982,7 @@ bool TYsonStructParameter<TValue>::IsRequired() const } template <class TValue> -const TString& TYsonStructParameter<TValue>::GetKey() const +const std::string& TYsonStructParameter<TValue>::GetKey() const { return Key_; } @@ -1029,7 +1029,7 @@ TYsonStructParameter<TValue>& TYsonStructParameter<TValue>::DontSerializeDefault // to do the deep validation. static_assert( NPrivate::CSupportsDontSerializeDefault<TValue>, - "DontSerializeDefault requires |Parameter| to be TString, TDuration, an arithmetic type or an optional of those"); + "DontSerializeDefault requires |Parameter| to be std::string, TDuration, an arithmetic type or an optional of those"); SerializeDefault_ = false; return *this; diff --git a/yt/yt/core/ytree/yson_struct_detail.cpp b/yt/yt/core/ytree/yson_struct_detail.cpp index f22b69ab8c..8f136387d1 100644 --- a/yt/yt/core/ytree/yson_struct_detail.cpp +++ b/yt/yt/core/ytree/yson_struct_detail.cpp @@ -42,22 +42,22 @@ void TYsonStructMeta::SetDefaultsOfInitializedStruct(TYsonStructBase* target) co } } -const THashSet<TString>& TYsonStructMeta::GetRegisteredKeys() const +const THashSet<std::string>& TYsonStructMeta::GetRegisteredKeys() const { return RegisteredKeys_; } -const THashMap<TString, IYsonStructParameterPtr>& TYsonStructMeta::GetParameterMap() const +const THashMap<std::string, IYsonStructParameterPtr>& TYsonStructMeta::GetParameterMap() const { return Parameters_; } -const std::vector<std::pair<TString, IYsonStructParameterPtr>>& TYsonStructMeta::GetParameterSortedList() const +const std::vector<std::pair<std::string, IYsonStructParameterPtr>>& TYsonStructMeta::GetParameterSortedList() const { return SortedParameters_; } -IYsonStructParameterPtr TYsonStructMeta::GetParameter(const TString& keyOrAlias) const +IYsonStructParameterPtr TYsonStructMeta::GetParameter(const std::string& keyOrAlias) const { auto it = Parameters_.find(keyOrAlias); if (it != Parameters_.end()) { @@ -72,7 +72,7 @@ IYsonStructParameterPtr TYsonStructMeta::GetParameter(const TString& keyOrAlias) THROW_ERROR_EXCEPTION("Key or alias %Qv not found in yson struct", keyOrAlias); } -void TYsonStructMeta::LoadParameter(TYsonStructBase* target, const TString& key, const NYTree::INodePtr& node) const +void TYsonStructMeta::LoadParameter(TYsonStructBase* target, const std::string& key, const NYTree::INodePtr& node) const { const auto& parameter = GetParameter(key); auto validate = [&] { @@ -130,7 +130,7 @@ void TYsonStructMeta::LoadStruct( auto mapNode = node->AsMap(); auto unrecognizedStrategy = target->InstanceUnrecognizedStrategy_.template value_or(MetaUnrecognizedStrategy_); for (const auto& [name, parameter] : SortedParameters_) { - TString key = name; + std::string key = name; auto child = mapNode->FindChild(name); // can be NULL for (const auto& alias : parameter->GetAliases()) { auto otherChild = mapNode->FindChild(alias); @@ -207,7 +207,7 @@ void TYsonStructMeta::LoadStruct( InsertOrCrash(pendingParameters, parameter.Get()); } - THashMap<TString, TString> aliasedData; + THashMap<std::string, std::string> aliasedData; auto processPossibleAlias = [&] ( IYsonStructParameter* parameter, @@ -241,7 +241,7 @@ void TYsonStructMeta::LoadStruct( EmplaceOrCrash(aliasedData, canonicalKey, std::move(data)); }; - auto processUnrecognized = [&] (const TString& key, NYson::TYsonPullParserCursor* cursor) { + auto processUnrecognized = [&] (const std::string& key, NYson::TYsonPullParserCursor* cursor) { if (unrecognizedStrategy == EUnrecognizedStrategy::Drop) { cursor->SkipComplexValue(); return; @@ -260,7 +260,7 @@ void TYsonStructMeta::LoadStruct( }; cursor->ParseMap([&] (NYson::TYsonPullParserCursor* cursor) { - auto key = ExtractTo<TString>(cursor); + auto key = ExtractTo<std::string>(cursor); auto it = keyToParameter.find(key); if (it == keyToParameter.end()) { processUnrecognized(key, cursor); @@ -304,7 +304,7 @@ IMapNodePtr TYsonStructMeta::GetRecursiveUnrecognized(const TYsonStructBase* tar return result; } -void TYsonStructMeta::RegisterParameter(TString key, IYsonStructParameterPtr parameter) +void TYsonStructMeta::RegisterParameter(std::string key, IYsonStructParameterPtr parameter) { YT_VERIFY(Parameters_.template emplace(std::move(key), std::move(parameter)).second); } @@ -356,7 +356,7 @@ void TYsonStructMeta::FinishInitialization(const std::type_info& structType) } } - SortedParameters_ = std::vector<std::pair<TString, IYsonStructParameterPtr>>(Parameters_.begin(), Parameters_.end()); + SortedParameters_ = std::vector<std::pair<std::string, IYsonStructParameterPtr>>(Parameters_.begin(), Parameters_.end()); std::sort( SortedParameters_.begin(), SortedParameters_.end(), diff --git a/yt/yt/core/ytree/yson_struct_detail.h b/yt/yt/core/ytree/yson_struct_detail.h index 9cbcdfcfdc..150c0e6254 100644 --- a/yt/yt/core/ytree/yson_struct_detail.h +++ b/yt/yt/core/ytree/yson_struct_detail.h @@ -98,8 +98,8 @@ struct IYsonStructParameter virtual bool CanOmitValue(const TYsonStructBase* self) const = 0; virtual bool IsRequired() const = 0; - virtual const TString& GetKey() const = 0; - virtual const std::vector<TString>& GetAliases() const = 0; + virtual const std::string& GetKey() const = 0; + virtual const std::vector<std::string>& GetAliases() const = 0; virtual IMapNodePtr GetRecursiveUnrecognized(const TYsonStructBase* self) const = 0; virtual void WriteSchema(const TYsonStructBase* self, NYson::IYsonConsumer* consumer) const = 0; @@ -118,13 +118,13 @@ DEFINE_REFCOUNTED_TYPE(IYsonStructParameter) struct IYsonStructMeta { - virtual const THashMap<TString, IYsonStructParameterPtr>& GetParameterMap() const = 0; - virtual const std::vector<std::pair<TString, IYsonStructParameterPtr>>& GetParameterSortedList() const = 0; + virtual const THashMap<std::string, IYsonStructParameterPtr>& GetParameterMap() const = 0; + virtual const std::vector<std::pair<std::string, IYsonStructParameterPtr>>& GetParameterSortedList() const = 0; virtual void SetDefaultsOfInitializedStruct(TYsonStructBase* target) const = 0; - virtual const THashSet<TString>& GetRegisteredKeys() const = 0; + virtual const THashSet<std::string>& GetRegisteredKeys() const = 0; virtual void PostprocessStruct(TYsonStructBase* target, const TYPath& path) const = 0; - virtual IYsonStructParameterPtr GetParameter(const TString& keyOrAlias) const = 0; - virtual void LoadParameter(TYsonStructBase* target, const TString& key, const NYTree::INodePtr& node) const = 0; + virtual IYsonStructParameterPtr GetParameter(const std::string& keyOrAlias) const = 0; + virtual void LoadParameter(TYsonStructBase* target, const std::string& key, const NYTree::INodePtr& node) const = 0; virtual void LoadStruct( TYsonStructBase* target, @@ -142,7 +142,7 @@ struct IYsonStructMeta virtual IMapNodePtr GetRecursiveUnrecognized(const TYsonStructBase* target) const = 0; - virtual void RegisterParameter(TString key, IYsonStructParameterPtr parameter) = 0; + virtual void RegisterParameter(std::string key, IYsonStructParameterPtr parameter) = 0; virtual void RegisterPreprocessor(std::function<void(TYsonStructBase*)> preprocessor) = 0; virtual void RegisterPostprocessor(std::function<void(TYsonStructBase*)> postprocessor) = 0; virtual void SetUnrecognizedStrategy(EUnrecognizedStrategy strategy) = 0; @@ -164,12 +164,12 @@ class TYsonStructMeta public: void SetDefaultsOfInitializedStruct(TYsonStructBase* target) const override; - const THashMap<TString, IYsonStructParameterPtr>& GetParameterMap() const override; - const std::vector<std::pair<TString, IYsonStructParameterPtr>>& GetParameterSortedList() const override; - const THashSet<TString>& GetRegisteredKeys() const override; + const THashMap<std::string, IYsonStructParameterPtr>& GetParameterMap() const override; + const std::vector<std::pair<std::string, IYsonStructParameterPtr>>& GetParameterSortedList() const override; + const THashSet<std::string>& GetRegisteredKeys() const override; - IYsonStructParameterPtr GetParameter(const TString& keyOrAlias) const override; - void LoadParameter(TYsonStructBase* target, const TString& key, const NYTree::INodePtr& node) const override; + IYsonStructParameterPtr GetParameter(const std::string& keyOrAlias) const override; + void LoadParameter(TYsonStructBase* target, const std::string& key, const NYTree::INodePtr& node) const override; void PostprocessStruct(TYsonStructBase* target, const TYPath& path) const override; @@ -189,7 +189,7 @@ public: IMapNodePtr GetRecursiveUnrecognized(const TYsonStructBase* target) const override; - void RegisterParameter(TString key, IYsonStructParameterPtr parameter) override; + void RegisterParameter(std::string key, IYsonStructParameterPtr parameter) override; void RegisterPreprocessor(std::function<void(TYsonStructBase*)> preprocessor) override; void RegisterPostprocessor(std::function<void(TYsonStructBase*)> postprocessor) override; void SetUnrecognizedStrategy(EUnrecognizedStrategy strategy) override; @@ -207,9 +207,9 @@ private: const std::type_info* StructType_; - THashMap<TString, IYsonStructParameterPtr> Parameters_; - std::vector<std::pair<TString, IYsonStructParameterPtr>> SortedParameters_; - THashSet<TString> RegisteredKeys_; + THashMap<std::string, IYsonStructParameterPtr> Parameters_; + std::vector<std::pair<std::string, IYsonStructParameterPtr>> SortedParameters_; + THashSet<std::string> RegisteredKeys_; std::vector<std::function<void(TYsonStructBase*)>> Preprocessors_; std::vector<std::function<void(TYsonStructBase*)>> Postprocessors_; @@ -273,7 +273,7 @@ public: using TValueType = typename TOptionalTraits<TValue>::TValue; TYsonStructParameter( - TString key, + std::string key, std::unique_ptr<IYsonFieldAccessor<TValue>> fieldAccessor, int fieldIndex); @@ -298,8 +298,8 @@ public: void Save(const TYsonStructBase* self, NYson::IYsonConsumer* consumer) const override; bool CanOmitValue(const TYsonStructBase* self) const override; bool IsRequired() const override; - const TString& GetKey() const override; - const std::vector<TString>& GetAliases() const override; + const std::string& GetKey() const override; + const std::vector<std::string>& GetAliases() const override; IMapNodePtr GetRecursiveUnrecognized(const TYsonStructBase* self) const override; void WriteSchema(const TYsonStructBase* self, NYson::IYsonConsumer* consumer) const override; @@ -337,7 +337,7 @@ public: // Register validator that checks value to be non empty. TYsonStructParameter& NonEmpty(); // Register alias for parameter. Used in deserialization. - TYsonStructParameter& Alias(const TString& name); + TYsonStructParameter& Alias(const std::string& name); // Set field to T() (or suitable analogue) before deserializations. TYsonStructParameter& ResetOnLoad(); // Uses given unrecognized strategy in |Load| if there was no strategy supplied. @@ -352,13 +352,13 @@ public: TYsonStructParameter& DefaultNew(TArgs&&... args); private: - const TString Key_; + const std::string Key_; std::unique_ptr<IYsonFieldAccessor<TValue>> FieldAccessor_; std::optional<std::function<TValue()>> DefaultCtor_; bool SerializeDefault_ = true; std::vector<TValidator> Validators_; - std::vector<TString> Aliases_; + std::vector<std::string> Aliases_; bool TriviallyInitializedIntrusivePtr_ = false; bool Optional_ = false; bool ResetOnLoad_ = false; diff --git a/yt/yt/core/ytree/yson_struct_update-inl.h b/yt/yt/core/ytree/yson_struct_update-inl.h index 5445005d39..3ffaa42e54 100644 --- a/yt/yt/core/ytree/yson_struct_update-inl.h +++ b/yt/yt/core/ytree/yson_struct_update-inl.h @@ -141,7 +141,7 @@ TConfigurator<TStruct>::TConfigurator(NDetail::TRegisteredFieldDirectoryPtr regi template <CYsonStructDerived TStruct> template <class TValue> -NDetail::TFieldRegistrar<TValue>& TConfigurator<TStruct>::Field(const TString& name, TYsonStructField<TStruct, TValue> field) +NDetail::TFieldRegistrar<TValue>& TConfigurator<TStruct>::Field(const std::string& name, TYsonStructField<TStruct, TValue> field) { IYsonStructParameterPtr parameter; diff --git a/yt/yt/core/ytree/yson_struct_update.h b/yt/yt/core/ytree/yson_struct_update.h index f138f68432..a6c9c1a54d 100644 --- a/yt/yt/core/ytree/yson_struct_update.h +++ b/yt/yt/core/ytree/yson_struct_update.h @@ -74,7 +74,7 @@ public: explicit TConfigurator(NDetail::TRegisteredFieldDirectoryPtr state = {}); template <class TValue> - NDetail::TFieldRegistrar<TValue>& Field(const TString& name, TYsonStructField<TStruct, TValue> field); + NDetail::TFieldRegistrar<TValue>& Field(const std::string& name, TYsonStructField<TStruct, TValue> field); // Converts to a registrar of a base class template <class TAncestor> |