@@ -125,8 +125,8 @@ class TSessionInfo {
125
125
126
126
}; // TSessionInfo
127
127
128
- struct TCredentialsKey : std::tuple<TString, TString, bool , TString> {
129
- explicit TCredentialsKey (const TString& endpoint, const TString& database, bool ssl, const TString& user)
128
+ struct TConnectionParams : std::tuple<TString, TString, bool , TString> {
129
+ explicit TConnectionParams (const TString& endpoint, const TString& database, bool ssl, const TString& user)
130
130
: std::tuple<TString, TString, bool, TString>(endpoint, database, ssl, user)
131
131
{
132
132
}
@@ -143,27 +143,27 @@ struct TCredentialsKey: std::tuple<TString, TString, bool, TString> {
143
143
return std::get<2 >(*this );
144
144
}
145
145
146
- static TCredentialsKey FromParams (const NKikimrReplication::TConnectionParams& params) {
146
+ static TConnectionParams FromProto (const NKikimrReplication::TConnectionParams& params) {
147
147
const auto & endpoint = params.GetEndpoint ();
148
148
const auto & database = params.GetDatabase ();
149
149
const bool ssl = params.GetEnableSsl ();
150
150
151
151
switch (params.GetCredentialsCase ()) {
152
152
case NKikimrReplication::TConnectionParams::kStaticCredentials :
153
- return TCredentialsKey (endpoint, database, ssl, params.GetStaticCredentials ().GetUser ());
153
+ return TConnectionParams (endpoint, database, ssl, params.GetStaticCredentials ().GetUser ());
154
154
case NKikimrReplication::TConnectionParams::kOAuthToken :
155
- return TCredentialsKey (endpoint, database, ssl, params.GetOAuthToken ().GetToken ());
155
+ return TConnectionParams (endpoint, database, ssl, params.GetOAuthToken ().GetToken ());
156
156
default :
157
157
Y_ABORT (" Unexpected credentials" );
158
158
}
159
159
}
160
160
161
- }; // TCredentialsKey
161
+ }; // TConnectionParams
162
162
163
163
} // NKikimr::NReplication::NService
164
164
165
165
template <>
166
- struct THash <NKikimr::NReplication::NService::TCredentialsKey > : THash<std::tuple<TString, TString, bool , TString>> {};
166
+ struct THash <NKikimr::NReplication::NService::TConnectionParams > : THash<std::tuple<TString, TString, bool , TString>> {};
167
167
168
168
namespace NKikimr ::NReplication {
169
169
@@ -217,11 +217,11 @@ class TReplicationService: public TActorBootstrapped<TReplicationService> {
217
217
}
218
218
219
219
template <typename ... Args>
220
- const TActorId& GetOrCreateYdbProxy (TCredentialsKey && key , Args&&... args) {
221
- auto it = YdbProxies.find (key );
220
+ const TActorId& GetOrCreateYdbProxy (TConnectionParams && params , Args&&... args) {
221
+ auto it = YdbProxies.find (params );
222
222
if (it == YdbProxies.end ()) {
223
- auto ydbProxy = Register (CreateYdbProxy (key .Endpoint (), key .Database (), key .EnableSsl (), std::forward<Args>(args)...));
224
- auto res = YdbProxies.emplace (std::move (key ), std::move (ydbProxy));
223
+ auto ydbProxy = Register (CreateYdbProxy (params .Endpoint (), params .Database (), params .EnableSsl (), std::forward<Args>(args)...));
224
+ auto res = YdbProxies.emplace (std::move (params ), std::move (ydbProxy));
225
225
Y_ABORT_UNLESS (res.second );
226
226
it = res.first ;
227
227
}
@@ -234,10 +234,10 @@ class TReplicationService: public TActorBootstrapped<TReplicationService> {
234
234
const auto & params = settings.GetConnectionParams ();
235
235
switch (params.GetCredentialsCase ()) {
236
236
case NKikimrReplication::TConnectionParams::kStaticCredentials :
237
- ydbProxy = GetOrCreateYdbProxy (TCredentialsKey::FromParams (params), params.GetStaticCredentials ());
237
+ ydbProxy = GetOrCreateYdbProxy (TConnectionParams::FromProto (params), params.GetStaticCredentials ());
238
238
break ;
239
239
case NKikimrReplication::TConnectionParams::kOAuthToken :
240
- ydbProxy = GetOrCreateYdbProxy (TCredentialsKey::FromParams (params), params.GetOAuthToken ().GetToken ());
240
+ ydbProxy = GetOrCreateYdbProxy (TConnectionParams::FromProto (params), params.GetOAuthToken ().GetToken ());
241
241
break ;
242
242
default :
243
243
Y_ABORT (" Unexpected credentials" );
@@ -438,7 +438,7 @@ class TReplicationService: public TActorBootstrapped<TReplicationService> {
438
438
mutable TMaybe<TString> LogPrefix;
439
439
TActorId BoardPublisher;
440
440
THashMap<ui64, TSessionInfo> Sessions;
441
- THashMap<TCredentialsKey , TActorId> YdbProxies;
441
+ THashMap<TConnectionParams , TActorId> YdbProxies;
442
442
THashMap<TActorId, ui64> WorkerActorIdToSession;
443
443
444
444
}; // TReplicationService
0 commit comments