Skip to content

Commit 032f14c

Browse files
dgolearblinkov
authored andcommitted
YT-22593: Switch to std::string in client lib
TRIVIAL commit_hash:b106b0bebfb14e206de256814297e39eb4ac9dd1
1 parent bd21d2b commit 032f14c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+157
-167
lines changed

yt/yt/client/api/rpc_proxy/connection_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ std::vector<std::string> TConnection::DiscoverProxiesViaHttp()
383383
auto poller = TTcpDispatcher::Get()->GetXferPoller();
384384
auto headers = New<THeaders>();
385385
SetUserAgent(headers, GetRpcUserAgent());
386-
if (auto token = DiscoveryToken_.Load()) {
386+
if (auto token = DiscoveryToken_.Load(); !token.empty()) {
387387
headers->Add("Authorization", "OAuth " + token);
388388
}
389389
headers->Add("X-YT-Correlation-Id", ToString(correlationId));

yt/yt/client/api/rpc_proxy/connection_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class TConnection
7676
NConcurrency::TPeriodicExecutorPtr UpdateProxyListExecutor_;
7777

7878
// TODO(prime@): Create HTTP endpoint for discovery that works without authentication.
79-
NThreading::TAtomicObject<TString> DiscoveryToken_;
79+
NThreading::TAtomicObject<std::string> DiscoveryToken_;
8080

8181
NServiceDiscovery::IServiceDiscoveryPtr ServiceDiscovery_;
8282

yt/yt/client/cache/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct TClientsCacheAuthentificationOptions final
3737
static TClientsCacheAuthentificationOptionsPtr GetFromEnvStatic();
3838

3939
NAuth::TAuthenticationOptions DefaultOptions;
40-
THashMap<TString, NAuth::TAuthenticationOptions> ClusterOptions;
40+
THashMap<std::string, NAuth::TAuthenticationOptions, THash<std::string>, TEqualTo<>> ClusterOptions;
4141
};
4242

4343
DEFINE_REFCOUNTED_TYPE(TClientsCacheAuthentificationOptions)

yt/yt/core/concurrency/fair_share_invoker_pool-inl.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,17 @@ TDiagnosableInvokerPoolPtr CreateEnumIndexedProfiledFairShareInvokerPool(
1414
IInvokerPtr underlyingInvoker,
1515
TFairShareCallbackQueueFactory callbackQueueFactory,
1616
TDuration actionTimeRelevancyHalflife,
17-
const TString& poolName,
17+
const std::string& poolName,
1818
NProfiling::IRegistryPtr registry)
1919
{
20-
using TTraits = TEnumTraits<EInvoker>;
21-
22-
std::vector<TString> bucketNames;
23-
bucketNames.reserve(TTraits::GetDomainSize());
24-
25-
for (const auto& enumName : TTraits::GetDomainNames()) {
26-
bucketNames.emplace_back(enumName);
27-
}
20+
const auto& domainNames = TEnumTraits<EInvoker>::GetDomainNames();
2821

2922
return CreateProfiledFairShareInvokerPool(
3023
std::move(underlyingInvoker),
3124
std::move(callbackQueueFactory),
3225
actionTimeRelevancyHalflife,
3326
poolName,
34-
bucketNames,
27+
/*bucketNames*/ {domainNames.begin(), domainNames.end()},
3528
std::move(registry));
3629
}
3730

yt/yt/core/concurrency/fair_share_invoker_pool.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ class TFairShareInvokerPoolProfiler
153153
};
154154

155155
static TObject Create(
156-
const TString& /*poolName*/,
157-
std::vector<TString> /*bucketNames*/,
156+
const std::string& /*poolName*/,
157+
std::vector<std::string> /*bucketNames*/,
158158
IRegistryPtr /*registry*/)
159159
{
160160
return {};
@@ -204,8 +204,8 @@ class TFairShareInvokerPoolProfiler<true>
204204
};
205205

206206
static TObject Create(
207-
const TString& poolName,
208-
std::vector<TString> bucketNames,
207+
const std::string& poolName,
208+
std::vector<std::string> bucketNames,
209209
IRegistryPtr registry)
210210
{
211211
return New<TFairShareInvokerPoolProfiler>(poolName, std::move(bucketNames), std::move(registry));
@@ -239,8 +239,8 @@ class TFairShareInvokerPoolProfiler<true>
239239
std::vector<TCountersPtr> Counters_;
240240

241241
TFairShareInvokerPoolProfiler(
242-
const TString& poolName,
243-
std::vector<TString> bucketNames,
242+
const std::string& poolName,
243+
std::vector<std::string> bucketNames,
244244
IRegistryPtr registry)
245245
{
246246
Counters_.reserve(std::ssize(bucketNames));
@@ -322,8 +322,8 @@ class TFairShareInvokerPool
322322
int invokerCount,
323323
TFairShareCallbackQueueFactory callbackQueueFactory,
324324
TDuration actionTimeRelevancyHalflife,
325-
const TString& poolName = "",
326-
std::vector<TString> bucketNames = {},
325+
const std::string& poolName = "",
326+
std::vector<std::string> bucketNames = {},
327327
IRegistryPtr registry = nullptr)
328328
: UnderlyingInvoker_(std::move(underlyingInvoker))
329329
, Queue_(callbackQueueFactory(invokerCount))
@@ -637,8 +637,8 @@ TDiagnosableInvokerPoolPtr CreateProfiledFairShareInvokerPool(
637637
IInvokerPtr underlyingInvoker,
638638
TFairShareCallbackQueueFactory callbackQueueFactory,
639639
TDuration actionTimeRelevancyHalflife,
640-
const TString& poolName,
641-
std::vector<TString> bucketNames,
640+
const std::string& poolName,
641+
std::vector<std::string> bucketNames,
642642
IRegistryPtr registry)
643643
{
644644
YT_VERIFY(0 < std::ssize(bucketNames) && std::ssize(bucketNames) < 100);

yt/yt/core/concurrency/fair_share_invoker_pool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ TDiagnosableInvokerPoolPtr CreateProfiledFairShareInvokerPool(
6464
IInvokerPtr underlyingInvoker,
6565
TFairShareCallbackQueueFactory callbackQueueFactory = CreateFairShareCallbackQueue,
6666
TDuration actionTimeRelevancyHalflife = TAdjustedExponentialMovingAverage::DefaultHalflife,
67-
const TString& poolName = "fair_share_invoker_pool",
68-
std::vector<TString> bucketNames = {},
67+
const std::string& poolName = "fair_share_invoker_pool",
68+
std::vector<std::string> bucketNames = {},
6969
NProfiling::IRegistryPtr registry = nullptr);
7070

7171
////////////////////////////////////////////////////////////////////////////////
@@ -78,7 +78,7 @@ TDiagnosableInvokerPoolPtr CreateEnumIndexedProfiledFairShareInvokerPool(
7878
IInvokerPtr underlyingInvoker,
7979
TFairShareCallbackQueueFactory callbackQueueFactory = CreateFairShareCallbackQueue,
8080
TDuration actionTimeRelevancyHalflife = TAdjustedExponentialMovingAverage::DefaultHalflife,
81-
const TString& poolName = "fair_share_invoker_pool",
81+
const std::string& poolName = "fair_share_invoker_pool",
8282
NProfiling::IRegistryPtr registry = nullptr);
8383

8484
////////////////////////////////////////////////////////////////////////////////

yt/yt/core/concurrency/fair_share_thread_pool.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ class TFairShareThread
477477
TFairShareThread(
478478
TFairShareQueuePtr queue,
479479
TIntrusivePtr<NThreading::TEventCount> callbackEventCount,
480-
const TString& threadGroupName,
481-
const TString& threadName,
480+
const std::string& threadGroupName,
481+
const std::string& threadName,
482482
NThreading::EThreadPriority threadPriority,
483483
int index)
484484
: TSchedulerThread(
@@ -520,7 +520,7 @@ class TFairShareThreadPool
520520
public:
521521
TFairShareThreadPool(
522522
int threadCount,
523-
const TString& threadNamePrefix)
523+
const std::string& threadNamePrefix)
524524
: TThreadPoolBase(threadNamePrefix)
525525
, Queue_(New<TFairShareQueue>(
526526
CallbackEventCount_,
@@ -586,7 +586,7 @@ class TFairShareThreadPool
586586

587587
IFairShareThreadPoolPtr CreateFairShareThreadPool(
588588
int threadCount,
589-
const TString& threadNamePrefix)
589+
const std::string& threadNamePrefix)
590590
{
591591
return New<TFairShareThreadPool>(
592592
threadCount,

yt/yt/core/concurrency/fair_share_thread_pool.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ DEFINE_REFCOUNTED_TYPE(IFairShareThreadPool)
2222

2323
IFairShareThreadPoolPtr CreateFairShareThreadPool(
2424
int threadCount,
25-
const TString& threadNamePrefix);
25+
const std::string& threadNamePrefix);
2626

2727
////////////////////////////////////////////////////////////////////////////////
2828

2929
} // namespace NYT::NConcurrency
30-

yt/yt/core/concurrency/fiber_scheduler_thread.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TRefCountedGauge
6060
, public NProfiling::TGauge
6161
{
6262
public:
63-
TRefCountedGauge(const NProfiling::TRegistry& profiler, const TString& name)
63+
TRefCountedGauge(const NProfiling::TRegistry& profiler, const std::string& name)
6464
: NProfiling::TGauge(profiler.Gauge(name))
6565
{ }
6666

@@ -123,7 +123,7 @@ struct TFiberContext
123123

124124
TFiberContext(
125125
TFiberSchedulerThread* fiberThread,
126-
const TString& threadGroupName)
126+
const std::string& threadGroupName)
127127
: FiberThread(fiberThread)
128128
, WaitingFibersCounter(New<NDetail::TRefCountedGauge>(
129129
NProfiling::TRegistry("/fiber").WithTag("thread", threadGroupName).WithHot(),
@@ -1038,8 +1038,8 @@ class TResumeGuard
10381038
////////////////////////////////////////////////////////////////////////////////
10391039

10401040
TFiberSchedulerThread::TFiberSchedulerThread(
1041-
TString threadGroupName,
1042-
TString threadName,
1041+
std::string threadGroupName,
1042+
std::string threadName,
10431043
NThreading::TThreadOptions options)
10441044
: TThread(std::move(threadName), std::move(options))
10451045
, ThreadGroupName_(std::move(threadGroupName))

yt/yt/core/concurrency/fiber_scheduler_thread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ class TFiberSchedulerThread
1616
{
1717
public:
1818
TFiberSchedulerThread(
19-
TString threadGroupName,
20-
TString threadName,
19+
std::string threadGroupName,
20+
std::string threadName,
2121
NThreading::TThreadOptions options = {});
2222

2323
//! Empty callback signals about stopping.
2424
virtual TClosure OnExecute() = 0;
2525

2626
private:
27-
const TString ThreadGroupName_;
27+
const std::string ThreadGroupName_;
2828

2929
void ThreadMain() override;
3030
};

0 commit comments

Comments
 (0)