aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtorilov <dtorilov@yandex-team.com>2024-08-20 14:27:10 +0300
committerdtorilov <dtorilov@yandex-team.com>2024-08-20 15:05:23 +0300
commitf5f12e973b10c3b7f6966da0dc6b9273125dfe79 (patch)
tree209398b0f648d0bbcad84799dad2287b1e9e16df
parent8adfc2f460167ff853d657246cb553877a9b8795 (diff)
downloadydb-f5f12e973b10c3b7f6966da0dc6b9273125dfe79.tar.gz
Revert "YT-21306: Add EnumHasDefaultValue"
This reverts commit d9b67f1778da2d15dd94f7285afe4e3490a233ab, reversing changes made to 461a09e0c18bd14cef7df8060e7f9537e3ad74b5. 92cdaf4185661b7058f6a30d5a532ad40b725345
-rw-r--r--library/cpp/yt/misc/cast-inl.h4
-rw-r--r--library/cpp/yt/misc/enum.h14
-rw-r--r--library/cpp/yt/string/enum-inl.h5
-rw-r--r--yt/yt/core/bus/public.cpp8
-rw-r--r--yt/yt/core/bus/public.h3
-rw-r--r--yt/yt/core/misc/protobuf_helpers-inl.h12
-rw-r--r--yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto2
7 files changed, 4 insertions, 44 deletions
diff --git a/library/cpp/yt/misc/cast-inl.h b/library/cpp/yt/misc/cast-inl.h
index 795682864f..a694394f88 100644
--- a/library/cpp/yt/misc/cast-inl.h
+++ b/library/cpp/yt/misc/cast-inl.h
@@ -124,10 +124,6 @@ T CheckedEnumCast(S value)
{
T result;
if (!TryEnumCast<T>(value, &result)) {
- if constexpr (TEnumHasDefaultValue<T>::value) {
- return GetDefaultValue(T{});
- }
-
throw TSimpleException(Sprintf("Error casting %s value \"%d\" to enum %s",
TypeName<S>().c_str(),
static_cast<int>(value),
diff --git a/library/cpp/yt/misc/enum.h b/library/cpp/yt/misc/enum.h
index 11e168948f..954b63cbc0 100644
--- a/library/cpp/yt/misc/enum.h
+++ b/library/cpp/yt/misc/enum.h
@@ -197,20 +197,6 @@ constexpr bool None(E value) noexcept;
////////////////////////////////////////////////////////////////////////////////
-template <typename E, typename = void>
- requires TEnumTraits<E>::IsEnum
-struct TEnumHasDefaultValue
- : std::false_type
-{ };
-
-template <typename E>
- requires TEnumTraits<E>::IsEnum
-struct TEnumHasDefaultValue<E, std::void_t<decltype(GetDefaultValue(std::declval<E>()))>>
- : std::is_same<decltype(GetDefaultValue(std::declval<E>())), E>
-{ };
-
-////////////////////////////////////////////////////////////////////////////////
-
} // namespace NYT
#define ENUM_INL_H_
diff --git a/library/cpp/yt/string/enum-inl.h b/library/cpp/yt/string/enum-inl.h
index 19ba1f7fe5..41f7197d15 100644
--- a/library/cpp/yt/string/enum-inl.h
+++ b/library/cpp/yt/string/enum-inl.h
@@ -87,11 +87,6 @@ T ParseEnum(TStringBuf value)
if (auto optionalResult = TryParseEnum<T>(value)) {
return *optionalResult;
}
-
- if constexpr (TEnumHasDefaultValue<T>::value) {
- return GetDefaultValue(T{});
- }
-
NYT::NDetail::ThrowMalformedEnumValueException(TEnumTraits<T>::GetTypeName(), value);
}
diff --git a/yt/yt/core/bus/public.cpp b/yt/yt/core/bus/public.cpp
index 0487d79fd6..6cff5f25eb 100644
--- a/yt/yt/core/bus/public.cpp
+++ b/yt/yt/core/bus/public.cpp
@@ -9,11 +9,5 @@ const TString LocalNetworkName("local");
////////////////////////////////////////////////////////////////////////////////
-EMultiplexingBand GetDefaultValue(EMultiplexingBand)
-{
- return EMultiplexingBand::Default;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
} // namespace NYT::NBus
+
diff --git a/yt/yt/core/bus/public.h b/yt/yt/core/bus/public.h
index ba06208732..f5359d51b7 100644
--- a/yt/yt/core/bus/public.h
+++ b/yt/yt/core/bus/public.h
@@ -36,8 +36,6 @@ DEFINE_ENUM(EMultiplexingBand,
((RealTime) (4))
);
-EMultiplexingBand GetDefaultValue(EMultiplexingBand);
-
YT_DEFINE_ERROR_ENUM(
((TransportError) (100))
((SslError) (119))
@@ -61,3 +59,4 @@ extern const TString LocalNetworkName;
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NBus
+
diff --git a/yt/yt/core/misc/protobuf_helpers-inl.h b/yt/yt/core/misc/protobuf_helpers-inl.h
index 00ae1906ff..adf5a30851 100644
--- a/yt/yt/core/misc/protobuf_helpers-inl.h
+++ b/yt/yt/core/misc/protobuf_helpers-inl.h
@@ -181,11 +181,7 @@ template <class T>
requires TEnumTraits<T>::IsEnum && (!TEnumTraits<T>::IsBitEnum)
void FromProto(T* original, int serialized)
{
- if constexpr (TEnumHasDefaultValue<T>::value) {
- *original = CheckedEnumCast<T>(serialized);
- } else {
- *original = static_cast<T>(serialized);
- }
+ *original = static_cast<T>(serialized);
}
template <class T>
@@ -199,11 +195,7 @@ template <class T>
requires TEnumTraits<T>::IsBitEnum
void FromProto(T* original, ui64 serialized)
{
- if constexpr (TEnumHasDefaultValue<T>::value) {
- *original = CheckedEnumCast<T>(serialized);
- } else {
- *original = static_cast<T>(serialized);
- }
+ *original = static_cast<T>(serialized);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
index 79e4c38f4f..705d627313 100644
--- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
+++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
@@ -225,8 +225,6 @@ enum EMultiplexingBand
MB_CONTROL = 1;
MB_HEAVY = 2;
MB_INTERACTIVE = 3;
- MB_REAL_TIME = 4;
- MB_JOURNAL = 5;
}
enum ETableSchemaModification