Skip to content

Commit 145b46d

Browse files
babenkoblinkov
babenko
authored andcommitted
Merge EProxyType and EProxyKind
commit_hash:89c30066a27f224f5135879027b1ebab9cb47715
1 parent e98ac7d commit 145b46d

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

yt/yt/client/api/public.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ DEFINE_ENUM(ETransactionCoordinatorPrepareMode,
8484
((Late) (1))
8585
);
8686

87-
DEFINE_ENUM(EProxyType,
87+
DEFINE_ENUM(EProxyKind,
8888
((Http) (1))
8989
((Rpc) (2))
9090
((Grpc) (3))

yt/yt/client/driver/etc_commands.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,9 @@ void TExecuteBatchCommand::DoExecute(ICommandContextPtr context)
408408

409409
void TDiscoverProxiesCommand::Register(TRegistrar registrar)
410410
{
411-
registrar.Parameter("type", &TThis::Type)
412-
.Default(EProxyType::Rpc);
411+
registrar.Parameter("kind", &TThis::Kind)
412+
.Alias("type")
413+
.Default(EProxyKind::Rpc);
413414
registrar.Parameter("role", &TThis::Role)
414415
.Default(DefaultRpcProxyRole);
415416
registrar.Parameter("address_type", &TThis::AddressType)
@@ -423,11 +424,11 @@ void TDiscoverProxiesCommand::Register(TRegistrar registrar)
423424
void TDiscoverProxiesCommand::DoExecute(ICommandContextPtr context)
424425
{
425426
TProxyDiscoveryRequest request{
426-
.Type = Type,
427+
.Kind = Kind,
427428
.Role = Role,
428429
.AddressType = AddressType,
429430
.NetworkName = NetworkName,
430-
.IgnoreBalancers = IgnoreBalancers
431+
.IgnoreBalancers = IgnoreBalancers,
431432
};
432433

433434
const auto& proxyDiscoveryCache = context->GetDriver()->GetProxyDiscoveryCache();

yt/yt/client/driver/etc_commands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class TDiscoverProxiesCommand
230230
static void Register(TRegistrar registrar);
231231

232232
private:
233-
NApi::EProxyType Type;
233+
NApi::EProxyKind Kind;
234234
std::string Role;
235235
NApi::NRpcProxy::EAddressType AddressType;
236236
std::string NetworkName;

yt/yt/client/driver/proxy_discovery_cache.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace NApi::NRpcProxy;
2626
TProxyDiscoveryRequest::operator size_t() const
2727
{
2828
return MultiHash(
29-
Type,
29+
Kind,
3030
Role,
3131
AddressType,
3232
NetworkName,
@@ -37,8 +37,8 @@ TProxyDiscoveryRequest::operator size_t() const
3737

3838
void FormatValue(TStringBuilderBase* builder, const TProxyDiscoveryRequest& request, TStringBuf /*spec*/)
3939
{
40-
builder->AppendFormat("{Type: %v, Role: %v, AddressType: %v, NetworkName: %v, IgnoreBalancers: %v}",
41-
request.Type,
40+
builder->AppendFormat("{Kind: %v, Role: %v, AddressType: %v, NetworkName: %v, IgnoreBalancers: %v}",
41+
request.Kind,
4242
request.Role,
4343
request.AddressType,
4444
request.NetworkName,
@@ -97,7 +97,7 @@ class TProxyDiscoveryCache
9797

9898
TYPath path;
9999
try {
100-
path = GetProxyRegistryPath(request.Type) + "/@";
100+
path = GetProxyRegistryPath(request.Kind) + "/@";
101101
} catch (const std::exception& ex) {
102102
YT_LOG_ERROR(ex, "Failed to get proxy registry path");
103103
return MakeFuture<std::optional<TProxyDiscoveryResponse>>(ex);
@@ -130,7 +130,7 @@ class TProxyDiscoveryCache
130130

131131
TYPath path;
132132
try {
133-
path = GetProxyRegistryPath(request.Type);
133+
path = GetProxyRegistryPath(request.Kind);
134134
} catch (const std::exception& ex) {
135135
YT_LOG_ERROR(ex, "Failed to get proxy registry path");
136136
return MakeFuture<TProxyDiscoveryResponse>(ex);
@@ -168,12 +168,12 @@ class TProxyDiscoveryCache
168168
}
169169

170170

171-
static TYPath GetProxyRegistryPath(EProxyType type)
171+
static TYPath GetProxyRegistryPath(EProxyKind type)
172172
{
173173
switch (type) {
174-
case EProxyType::Rpc:
174+
case EProxyKind::Rpc:
175175
return RpcProxiesPath;
176-
case EProxyType::Grpc:
176+
case EProxyKind::Grpc:
177177
return GrpcProxiesPath;
178178
default:
179179
THROW_ERROR_EXCEPTION("Proxy type %Qlv is not supported",

yt/yt/client/driver/proxy_discovery_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace NYT::NDriver {
1414

1515
struct TProxyDiscoveryRequest
1616
{
17-
NApi::EProxyType Type;
17+
NApi::EProxyKind Kind = NApi::EProxyKind::Rpc;
1818
std::string Role = NApi::DefaultRpcProxyRole;
1919
NApi::NRpcProxy::EAddressType AddressType = NApi::NRpcProxy::DefaultAddressType;
2020
std::string NetworkName = NApi::NRpcProxy::DefaultNetworkName;

yt/yt/client/security_client/public.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ YT_DEFINE_ERROR_ENUM(
7676
((IrreversibleAclModification) (909))
7777
);
7878

79-
// NB: Changing this list requires reign promotion.
80-
DEFINE_ENUM(EProxyKind,
81-
((Http) (1))
82-
((Rpc) (2))
83-
);
84-
8579
DEFINE_ENUM(EAccessControlObjectNamespace,
8680
(AdminCommands)
8781
);

0 commit comments

Comments
 (0)