Skip to content

Commit f22ed95

Browse files
committed
59_issue
1 parent 1fac6f9 commit f22ed95

File tree

16 files changed

+119
-112
lines changed

16 files changed

+119
-112
lines changed

client/ydb_persqueue_core/ut/read_session_ut.cpp

Lines changed: 71 additions & 67 deletions
Large diffs are not rendered by default.

client/ydb_persqueue_core/ut/ut_utils/test_server.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TTestServer {
1919
bool start = true,
2020
const std::vector<NKikimrServices::EServiceKikimr>& logServices = TTestServer::LOGGED_SERVICES,
2121
NActors::NLog::EPriority logPriority = NActors::NLog::PRI_DEBUG,
22-
std::optional<TSimpleSharedPtr<TPortManager>> portManager = std::nullopt)
22+
TMaybe<TSimpleSharedPtr<TPortManager>> portManager = Nothing())
2323
: PortManager(portManager.GetOrElse(MakeSimpleShared<TPortManager>()))
2424
, Port(PortManager->GetPort(2134))
2525
, GrpcPort(PortManager->GetPort(2135))
@@ -44,7 +44,7 @@ class TTestServer {
4444
{
4545
}
4646

47-
void StartServer(bool doClientInit = true, std::optional<std::string> databaseName = std::nullopt) {
47+
void StartServer(bool doClientInit = true, TMaybe<std::string> databaseName = Nothing()) {
4848
Log.SetFormatter([](ELogPriority priority, std::string_view message) {
4949
return TYdbStringBuilder() << TInstant::Now() << " " << priority << ": " << message << Endl;
5050
});
@@ -136,7 +136,7 @@ class TTestServer {
136136

137137
if (killPq)
138138
{
139-
THashSet<ui64> restartedTablets;
139+
std::unordered_set<ui64> restartedTablets;
140140
for (const auto& p : persQueueGroup.GetPartitions())
141141
if (restartedTablets.insert(p.GetTabletId()).second)
142142
{
@@ -168,4 +168,4 @@ class TTestServer {
168168
static const std::vector<NKikimrServices::EServiceKikimr> LOGGED_SERVICES;
169169
};
170170

171-
} // namespace NPersQueue
171+
} // namespace NPersQueue

library/cpp/charset/wide_ut.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <util/charset/utf8.h>
88
#include <util/digest/numeric.h>
9-
#include <util/generic/hash_set.h>
109

1110
#include <algorithm>
1211

@@ -244,7 +243,7 @@ void TConversionTest::TestRecodeIntoString() {
244243
TUtf16String sUnicode;
245244
sUnicode.reserve(YandexText.size() * 4);
246245
const wchar16* wdata = sUnicode.data();
247-
std::u16string_view wres = NDetail::Recode<char>(YandexText, sUnicode, CODES_YANDEX);
246+
TWtringBuf wres = NDetail::Recode<char>(YandexText, sUnicode, CODES_YANDEX);
248247
UNIT_ASSERT(sUnicode == UnicodeText); // same content
249248
UNIT_ASSERT(sUnicode.data() == wdata); // reserved buffer reused
250249
UNIT_ASSERT(sUnicode.data() == wres.data()); // same buffer
@@ -350,7 +349,7 @@ void TConversionTest::TestRecode() {
350349
if (!SingleByteCodepage(enc))
351350
continue;
352351

353-
using THash = THashSet<char>;
352+
using THash = std::unordered_set<char>;
354353
THash hash;
355354

356355
for (int i = 0; i != 256; ++i) {
@@ -402,13 +401,13 @@ void TConversionTest::TestUnicodeLimit() {
402401
}
403402

404403
static void TestCanEncodeEmpty() {
405-
std::u16string_view empty;
404+
TWtringBuf empty;
406405
UNIT_ASSERT(CanBeEncoded(empty, CODES_WIN));
407406
UNIT_ASSERT(CanBeEncoded(empty, CODES_YANDEX));
408407
UNIT_ASSERT(CanBeEncoded(empty, CODES_UTF8));
409408
}
410409

411-
static void TestCanEncodeEach(const std::u16string_view& text, ECharset encoding, bool expectedResult) {
410+
static void TestCanEncodeEach(const TWtringBuf& text, ECharset encoding, bool expectedResult) {
412411
// char by char
413412
for (size_t i = 0; i < text.size(); ++i) {
414413
if (CanBeEncoded(text.SubStr(i, 1), encoding) != expectedResult)
@@ -478,4 +477,4 @@ void TConversionTest::TestCanEncode() {
478477
TestCanEncodeEach(jap, CODES_YANDEX, false);
479478
TestCanEncodeEach(jap, CODES_UTF8, true);
480479
TestCanEncodeEach(jap, CODES_UTF_16BE, true);
481-
}
480+
}

library/cpp/dbg_output/dumpers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <map>
99
#include <string>
1010
#include <string_view>
11+
#include <unordered_set>
1112

1213
//smart pointers
1314
template <class T, class D>
@@ -139,7 +140,7 @@ struct TDumper<THashMultiMap<K, V, H, P, A>>: public TAssocDumper {
139140
};
140141

141142
template <class T, class H, class P, class A>
142-
struct TDumper<THashSet<T, H, P, A>>: public TAssocDumper {
143+
struct TDumper<std::unordered_set<T, H, P, A>>: public TAssocDumper {
143144
};
144145

145146
template <class T, class H, class P, class A>

library/cpp/getopt/small/completion_generator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <util/generic/overloaded.h>
44

55
#include "last_getopt_parse_result.h"
6+
#include <unordered_set>
67

78
using NLastGetopt::NEscaping::Q;
89
using NLastGetopt::NEscaping::QQ;
@@ -246,7 +247,7 @@ namespace NLastGetopt {
246247
void TZshCompletionGenerator::GenerateOptCompletion(TFormattedOutput& out, const TOpts& opts, const TOpt& opt, NComp::TCompleterManager& manager) {
247248
auto& line = L;
248249

249-
THashSet<std::string> disableOptions;
250+
std::unordered_set<std::string> disableOptions;
250251
if (opt.DisableCompletionForOptions_) {
251252
disableOptions.insert("-");
252253
} else {
@@ -785,4 +786,4 @@ namespace NLastGetopt {
785786
auto b = B(string);
786787
return "'" + b + "'";
787788
}
788-
}
789+
}

library/cpp/getopt/small/last_getopt_opt.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <util/string/join.h>
88

99
#include <optional>
10+
#include <unordered_set>
1011

1112
namespace NLastGetopt {
1213
enum EHasArg {
@@ -75,7 +76,7 @@ namespace NLastGetopt {
7576
TdOptVal OptionalValue_;
7677
TdOptVal DefaultValue_;
7778
TOptHandlers Handlers_;
78-
THashSet<std::string> Choices_;
79+
std::unordered_set<std::string> Choices_;
7980

8081
public:
8182
/**
@@ -703,7 +704,7 @@ namespace NLastGetopt {
703704

704705
// Appends FromString<T>(arg) to *target for each argument
705706
template <typename T>
706-
TOpt& InsertTo(THashSet<T>* target) {
707+
TOpt& InsertTo(std::unordered_set<T>* target) {
707708
return Handler1T<T>([target](auto&& value) { target->insert(std::forward<decltype(value)>(value)); });
708709
}
709710

@@ -742,11 +743,11 @@ namespace NLastGetopt {
742743

743744
template <typename TIterator>
744745
TOpt& Choices(TIterator begin, TIterator end) {
745-
return Choices(THashSet<typename TIterator::value_type>{begin, end});
746+
return Choices(std::unordered_set<typename TIterator::value_type>{begin, end});
746747
}
747748

748749
template <typename TValue>
749-
TOpt& Choices(THashSet<TValue> choices) {
750+
TOpt& Choices(std::unordered_set<TValue> choices) {
750751
Choices_ = std::move(choices);
751752
return Handler1T<TValue>(
752753
[this] (const TValue& arg) {
@@ -759,15 +760,15 @@ namespace NLastGetopt {
759760

760761
TOpt& Choices(std::vector<std::string> choices) {
761762
return Choices(
762-
THashSet<std::string>{
763+
std::unordered_set<std::string>{
763764
std::make_move_iterator(choices.begin()),
764765
std::make_move_iterator(choices.end())
765766
});
766767
}
767768

768769
TOpt& ChoicesWithCompletion(std::vector<NComp::TChoice> choices) {
769770
Completer(NComp::Choice(choices));
770-
THashSet<std::string> choicesSet;
771+
std::unordered_set<std::string> choicesSet;
771772
choicesSet.reserve(choices.size());
772773
for (const auto& choice : choices) {
773774
choicesSet.insert(choice.Choice);

library/cpp/http/io/stream.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
#include <util/string/strip.h>
2020

21-
#include <util/generic/hash_set.h>
21+
#include <unordered_set>
22+
2223

2324
#define HEADERCMP(header, str) \
2425
case sizeof(str) - 1: \
@@ -129,7 +130,7 @@ namespace {
129130
}
130131

131132
class THttpInput::TImpl {
132-
typedef THashSet<std::string> TAcceptCodings;
133+
typedef std::unordered_set<std::string> TAcceptCodings;
133134

134135
public:
135136
inline TImpl(IInputStream* slave)

library/cpp/http/server/http_ut.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
970970

971971
}
972972

973-
inline std::string ToString(const THashSet<std::string>& hs) {
973+
inline std::string ToString(const std::unordered_set<std::string>& hs) {
974974
std::string res = "";
975975
for (auto s : hs) {
976976
if (res) {
@@ -998,7 +998,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
998998
UNIT_ASSERT(srv.Start());
999999
UNIT_ASSERT(server.Lock.try_lock());
10001000

1001-
THashSet<std::string> results;
1001+
std::unordered_set<std::string> results;
10021002
std::mutex resultLock;
10031003
auto func = [port, &resultLock, &results]() {
10041004
try {
@@ -1016,6 +1016,6 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
10161016
server.Lock.unlock();
10171017
t1->Join();
10181018
t2->Join();
1019-
UNIT_ASSERT_EQUAL_C(results, (THashSet<std::string>({"Zoooo", "TTL Exceed"})), "Results is {" + ToString(results) + "}");
1019+
UNIT_ASSERT_EQUAL_C(results, (std::unordered_set<std::string>({"Zoooo", "TTL Exceed"})), "Results is {" + ToString(results) + "}");
10201020
}
10211021
}

library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include <library/cpp/monlib/metrics/metric_value.h>
88

99
#include <util/string/cast.h>
10-
#include <util/generic/hash_set.h>
11-
10+
#include <unordered_set>
1211

1312
namespace NMonitoring {
1413
namespace {
@@ -191,7 +190,7 @@ namespace NMonitoring {
191190

192191
private:
193192
IOutputStream* Out_;
194-
THashSet<std::string> WrittenTypes_;
193+
std::unordered_set<std::string> WrittenTypes_;
195194
char TmpBuf_[512]; // used to convert doubles to strings
196195
};
197196

library/cpp/testing/unittest/utmain.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <util/datetime/base.h>
1414

1515
#include <util/generic/hash.h>
16-
#include <util/generic/hash_set.h>
1716
#include <util/generic/scope.h>
1817
#include <string>
1918
#include <util/generic/yexception.h>
@@ -581,10 +580,10 @@ class TColoredProcessor: public ITestSuiteProcessor, public NColorizer::TColors
581580
bool PrintAfterSuite_;
582581
bool PrintTimes_;
583582
bool PrintSummary_;
584-
THashSet<std::string> DisabledSuites_;
585-
THashSet<std::string> EnabledSuites_;
586-
THashSet<std::string> DisabledTests_;
587-
THashSet<std::string> EnabledTests_;
583+
std::unordered_set<std::string> DisabledSuites_;
584+
std::unordered_set<std::string> EnabledSuites_;
585+
std::unordered_set<std::string> DisabledTests_;
586+
std::unordered_set<std::string> EnabledTests_;
588587
TInstant PrevTime_;
589588
bool ShowFails;
590589
std::vector<std::string> Fails;

util/generic/ptr_ut.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <library/cpp/testing/common/probe.h>
66
#include <library/cpp/testing/unittest/registar.h>
77

8-
#include <util/generic/hash_set.h>
8+
#include <unordered_set>
99
#include <util/generic/is_in.h>
1010
#include <util/system/thread.h>
1111

@@ -741,7 +741,7 @@ void TPointerTest::TestComparison() {
741741

742742
template <class T, class TRefCountedPtr>
743743
void TPointerTest::TestRefCountedPtrsInHashSetImpl() {
744-
THashSet<TRefCountedPtr> hashSet;
744+
std::unordered_set<TRefCountedPtr> hashSet;
745745
TRefCountedPtr p1(new T());
746746
UNIT_ASSERT(!IsIn(hashSet, p1));
747747
UNIT_ASSERT(hashSet.insert(p1).second);

util/network/endpoint_ut.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <library/cpp/testing/unittest/registar.h>
44

5-
#include <util/generic/hash_set.h>
5+
#include <unordered_set>
66

77
Y_UNIT_TEST_SUITE(TEndpointTest) {
88
Y_UNIT_TEST(TestSimple) {
@@ -63,7 +63,7 @@ Y_UNIT_TEST_SUITE(TEndpointTest) {
6363

6464
ep3_.SetPort(54321);
6565

66-
THashSet<TEndpoint> he;
66+
std::unordered_set<TEndpoint> he;
6767

6868
he.insert(ep0);
6969
he.insert(ep1);

util/network/socket.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
#include <stddef.h>
4747
#include <sys/uio.h>
48+
#include <unordered_set>
4849

4950
using namespace NAddr;
5051

@@ -947,7 +948,7 @@ void TSocketOutput::DoWriteV(const TPart* parts, size_t count) {
947948
namespace {
948949
//https://bugzilla.mozilla.org/attachment.cgi?id=503263&action=diff
949950

950-
struct TLocalNames: public THashSet<std::string_view> {
951+
struct TLocalNames: public std::unordered_set<std::string_view> {
951952
inline TLocalNames() {
952953
insert("localhost");
953954
insert("localhost.localdomain");

util/thread/pool_ut.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,12 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) {
204204
}
205205
}
206206

207-
void TestEnumeratedThreadName(IThreadPool& pool, const THashSet<std::string>& expectedNames) {
207+
void TestEnumeratedThreadName(IThreadPool& pool, const std::unordered_set<std::string>& expectedNames) {
208208
pool.Start(expectedNames.size());
209209
std::mutex lock;
210210
std::condition_variable allReady;
211211
size_t readyCount = 0;
212-
THashSet<std::string> names;
212+
std::unordered_set<std::string> names;
213213
for (size_t i = 0; i < expectedNames.size(); ++i) {
214214
pool.SafeAddFunc([&]() {
215215
std::unique_lock ulock(lock);
@@ -231,7 +231,7 @@ Y_UNIT_TEST_SUITE(TThreadPoolTest) {
231231

232232
Y_UNIT_TEST(TestEnumeratedThreadName) {
233233
const std::string namePrefix = "HelloWorld";
234-
const THashSet<std::string> expectedNames = {
234+
const std::unordered_set<std::string> expectedNames = {
235235
"HelloWorld0",
236236
"HelloWorld1",
237237
"HelloWorld2",

util/ysaveload.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <map>
1515
#include <set>
1616
#include <string>
17+
#include <unordered_set>
1718

1819
#ifndef __NVCC__
1920
// cuda is compiled in C++14 mode at the time
@@ -528,8 +529,8 @@ class TSetSerializerInserter<THashMultiMap<T1, T2, T3, T4, T5>, TValue, false>:
528529
};
529530

530531
template <class T1, class T2, class T3, class T4, class TValue>
531-
class TSetSerializerInserter<THashSet<T1, T2, T3, T4>, TValue, false>: public TSetSerializerInserterBase<THashSet<T1, T2, T3, T4>, TValue> {
532-
using TSetType = THashSet<T1, T2, T3, T4>;
532+
class TSetSerializerInserter<std::unordered_set<T1, T2, T3, T4>, TValue, false>: public TSetSerializerInserterBase<THashSet<T1, T2, T3, T4>, TValue> {
533+
using TSetType = std::unordered_set<T1, T2, T3, T4>;
533534
using TBase = TSetSerializerInserterBase<TSetType, TValue>;
534535

535536
public:
@@ -605,7 +606,7 @@ class TSerializer<std::set<K, C, A>>: public TSetSerializer<std::set<K, C, A>, t
605606
};
606607

607608
template <class T1, class T2, class T3, class T4>
608-
class TSerializer<THashSet<T1, T2, T3, T4>>: public TSetSerializer<THashSet<T1, T2, T3, T4>, false> {
609+
class TSerializer<std::unordered_set<T1, T2, T3, T4>>: public TSetSerializer<std::unordered_set<T1, T2, T3, T4>, false> {
609610
};
610611

611612
template <class T1, class T2>

util/ysaveload_ut.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <util/generic/deque.h>
1111

1212
#include <util/generic/buffer.h>
13-
#include <util/generic/hash_set.h>
13+
#include <unordered_set>
1414

1515
static inline char* AllocateFromPool(TMemoryPool& pool, size_t len) {
1616
return (char*)pool.Allocate(len);
@@ -278,7 +278,7 @@ class TSaveLoadTest: public TTestBase {
278278
UNIT_ASSERT_EQUAL(multimap.find((ui16)1)->second, 2);
279279
UNIT_ASSERT_EQUAL(multimap.find((ui16)3)->second, 6);
280280

281-
THashSet<ui32> values;
281+
std::unordered_set<ui32> values;
282282
auto range = multimap.equal_range((ui16)2);
283283
for (auto i = range.first; i != range.second; ++i) {
284284
values.insert(i->second);

0 commit comments

Comments
 (0)